flutter2环境下的ListView

实现效果:


image.png

可以作为分栏目滑动组件使用(水平滑动样式)

代码如下:

Container(
      height: 180.0,
      child: ListView(
        scrollDirection: Axis.horizontal,   // 水平设置
        children: [
          Container(
            width: 180.0,
            height: 180.0,
            color: Colors.red,
          ),
          Container(
            width: 180.0,
            height: 180.0,
            color: Colors.blue,
          ),
          Container(
            width: 180.0,
            height: 180.0,
            color: Colors.green,
          ),
          Container(
            width: 180.0,
            height: 180.0,
            color: Colors.yellow,
          ),
          Container(
            width: 180.0,
            height: 180.0,
            color: Colors.deepOrange,
          ),
          Container(
            width: 180.0,
            height: 180.0,
            color: Colors.lightBlue,
          ),
        ],
      ),
    );

你可能感兴趣的:(flutter2环境下的ListView)