'How to set table column size in TableRow for Flutter Table

I have no idea how to set table column size in Flutter. If I use Row, Expanded can be used, but TableRow does not allow it.

Please tell me some advice how to set table column size. The best solution for me is adjust to size of text length in columns.



Solution 1:[1]

For your specific case you can use

Table(
  defaultColumnWidth: IntrinsicColumnWidth(),
  ...
);

, since you want the column width to adjust to the text lengths. IntrinsicColumnWidth sizes the column based on the width of the content in each cell, ie, the column width increases or shrinks depending upon the length of the content in the cell.

Solution 2:[2]

You can also make two column width fixed.

Table(
      border: TableBorder.all(color: Colors.black),
      columnWidths: {
            0: FixedColumnWidth(100.0),// fixed to 100 width
            1: FlexColumnWidth(),
            2: FixedColumnWidth(100.0),//fixed to 100 width
          },

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Philippe Fanaro
Solution 2 Krishnamoorthy Acharya