【发布时间】: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