Flow Layout in flutter example

前端 未结 2 1113
日久生厌
日久生厌 2021-02-13 14:40

i want to implement flow layout in flutter i found a class called FLOW in sdk but unable to find sample code on how to use it

here is the layout i am trying to achieve

2条回答
  •  悲&欢浪女
    2021-02-13 15:14

    Use Wrap instead of Flow.

    Flow is for more complicated custom layout. Wrap is what is used to achieve the layout in your screenshot.

    Wrap(
      spacing: 8.0, // gap between adjacent chips
      runSpacing: 4.0, // gap between lines
      children: [
          Chip(
            avatar: CircleAvatar(backgroundColor: Colors.blue.shade900, child: Text('AH')),
            label: Text('Hamilton'),
          ),
          Chip(
            avatar: CircleAvatar(backgroundColor: Colors.blue.shade900, child: Text('ML')),
            label: Text('Lafayette'),
          ),
          Chip(
            avatar: CircleAvatar(backgroundColor: Colors.blue.shade900, child: Text('HM')),
            label: Text('Mulligan'),
          ),
          Chip(
            avatar: CircleAvatar(backgroundColor: Colors.blue.shade900, child: Text('JL')),
            label: Text('Laurens'),
          ),
      ],
    )
    

提交回复
热议问题