颤动水平滚动图像和小部件

时间:2018-12-19 19:33:50

标签: dart flutter

我如何制作像这样的水平滚动小部件,其中包含图像?

[![在此处输入图片描述] [1]] [1]

1 个答案:

答案 0 :(得分:0)

ListView(
  scrollDirection: Axis.horizontal, // <-- Like so
  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,
    ),
  ],
)

代码基于flutter的docs