如何使 ListView 像图像一样水平滚动
另一种解释我想在黑色容器内建立这样一个滚动列表 截图
![在此处输入图片描述][1]
代码
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,
),
],
)
),
),
)
最佳答案
您知道列小部件吗?如果不是,请尝试并告诉我这是否是您想要的
关于dart - 我如何在容器内构建 ListView 滚动?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55460110/