Flutter 示例中的流布局 [英] Flow Layout in flutter example

查看:10
本文介绍了Flutter 示例中的流布局的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在 Flutter 中实现流布局,我在 sdk 中找到了一个名为 FLOW 的类,但找不到有关如何使用它的示例代码

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

这是我想要实现的布局

推荐答案

使用Wrap 而不是 Flow.

Flow 用于更复杂的自定义布局.Wrap 是用来在你的截图中实现布局的.

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: <Widget>[
      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'),
      ),
  ],
)

这篇关于Flutter 示例中的流布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆