【问题标题】:How to make a list view builder inside a Row inside a column如何在列内的行内创建列表视图构建器
【发布时间】:2021-02-11 20:23:18
【问题描述】:

我想使用 [list view builder] 添加一个包含容器的行,当该行包含 3 个容器时,下一个容器转到另一行 { 我的意思是 [列 [有一行 [有最多 3 个容器] ] ] 和我谁控制容器的数量,这是我要修改的代码

enter image description here

【问题讨论】:

    标签: android flutter row dynamic-columns


    【解决方案1】:

    我认为 GridView 是您正在寻找的。​​p>

    GridView.count(
      // Will create 3 columns, each column will contain 1 element per row.
      // This will create a 3 elements per row impression.
      crossAxisCount: 3,
      // Generate 100 widgets that display their index in the List.
      children: List.generate(100, (index) {
        return Center(
          child: Text(
            'Item $index',
            style: Theme.of(context).textTheme.headline5,
          ),
        );
      }),
    );
    

    请实现这个 sn-p 以查看它是否创建了您想要的布局,如果是,请调整它以显示您想要的小部件。

    字体:https://flutter.dev/docs/cookbook/lists/grid-lists

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-05-24
      • 2021-10-08
      • 1970-01-01
      • 1970-01-01
      • 2013-07-21
      • 1970-01-01
      • 2016-05-17
      相关资源
      最近更新 更多