0

How I can make listview horizontal scroll like the image

Another explanation I want to build such a scroll list inside the black container Screenshot

![enter image description here][1]

Code

    body: Center (
       child: Container(
        height: 400.0,
        width: 300.0,        
        color: Colors.white,
        child: Container(
          margin: EdgeInsets.symmetric(vertical: 90.0),
          child: ListView(
            // This next line does the trick.
            scrollDirection: Axis.horizontal,
            children: <Widget>[
              Container(
                width: 160.0,
                color: Colors.red,
              ),
              Container(
                width: 160.0,
                color: Colors.blue,
              ),
              Container(
                width: 160.0,
                color: Colors.green,
              ),
              Container(
                width: 160.0,
                color: Colors.yellow,
              ),
              Container(
                width: 160.0,
                color: Colors.orange,
              ),
            ],
          )
        ),    
      ),
    )

2 Answers 2

1

do you know about column widget ? if no then try it and tell me if this what you want or not

Sign up to request clarification or add additional context in comments.

1 Comment

ok after you changed your post now its more clear i would say you need a column widget add the first child of column widget a card widget then add listview as a child to card
0

Replace your Center widget by Align and set the alignment according what you need:

            body: Align(
                      alignment: Alignment.bottomCenter, // or Alignment.topCenter
                      child: Container(
                        height: 200.0,
                        width: 300.0,
                        color: Colors.white,
                        child: Container(
                            child: ListView(     
                            ...

11 Comments

bro I mean ListView Alignment inside the white container
Yep, don't forget to remove the margin from your container
bro you move the white box not the listview i need move position of the listview to top or inside white box
Could you update your question with my code and see how it works? Add a screenshot
Update your question using my code to check if it is correct
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.