【问题标题】:How to make different number of column in Flutter using Datatable or Table wigets?如何使用数据表或表小部件在 Flutter 中制作不同数量的列?
【发布时间】:2022-11-07 01:38:28
【问题描述】:

我想在 Flutter 中创建一个这样的表。

当我尝试使用 Datatable 或 Table 小部件执行此操作时,它给了我一个错误。它说因为表中每一行的列数必须相等。我通过使用不同的表格小部件解决了这个问题。现在,我创建了两个表并使用了一个表小部件,一个具有较少的列,另一个具有相同的列数。

Column(
      children: [
        Table(
          children: const [
            TableRow(children: [
              Text("Column Header"),
            ])
          ],
        ),
        Table(
          children: const [
            TableRow(children: [
              Text("Col1"),
              Text("Col2"),
              Text("Col3"),
              Text("Col4"),
            ]),
            TableRow(children: [
              Text("x1"),
              Text("x5"),
              Text("x9"),
              Text("x13"),
            ])
          ],
        ),
      ],
    )

但是有没有更好的方法来做到这一点?

【问题讨论】:

    标签: flutter dart datatable flutter-layout flutter-web


    【解决方案1】:

    在网上做了一些研究后,我找到了一个名为同步融合.我解决了我的问题堆叠的标题this 库提供。

    【讨论】:

      猜你喜欢
      • 2020-10-16
      • 2021-03-26
      • 1970-01-01
      • 2019-03-31
      • 1970-01-01
      • 2021-12-14
      • 2021-10-10
      • 1970-01-01
      • 2019-02-22
      相关资源
      最近更新 更多