Flutter 使 TableRow 占用剩余的可用空间

ler*_*ler 3 flutter

我有一个 3 行的表格,该IntrinsicColumnWidth方法根据该列中所有单元格的内在尺寸设置列的大小。这意味着它们将采用尽可能小的宽度。这正是我想要的第一列和第二列。我的问题是如何让第三行占用其余可用空间

Table(
   columnWidths: {
     0: IntrinsicColumnWidth(),
     1: IntrinsicColumnWidth(),
     2: IntrinsicColumnWidth(), // i want this one to take the rest available space
   },
   ...
),
Run Code Online (Sandbox Code Playgroud)

小智 7

我知道现在已经晚了,但是对于正在寻找此问题答案的其他人,您可以尝试以下代码。

Table(
   columnWidths: {
     0: FlexColumnWidth(1.0),
     1: FlexColumnWidth(1.0),
     2: IntrinsicColumnWidth(), // i want this one to take the rest available space
   },
   ...
),
Run Code Online (Sandbox Code Playgroud)

  • 解释为什么此代码应该起作用将使您的答案成为更好的教材。 (2认同)