Reputation: 119
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,
),
],
)
),
),
)
Upvotes: 0
Views: 193
Reputation: 426
do you know about column widget ? if no then try it and tell me if this what you want or not
Upvotes: 1
Reputation: 103351
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(
...
Upvotes: 0