How to set table column size in TableRow for Flutter Table

Issue

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

Method 1

You can use defaultColumnWidth inside Table if you want to set same width to each column,

Table(
    defaultColumnWidth: FixedColumnWidth(200.0),
...

Output

enter image description here


Method 2

you can use a different width for each column.

Table(
columnWidths: {
                0: FlexColumnWidth(1),
                1: FlexColumnWidth(4),
                2: FlexColumnWidth(4),
              },     
...

Output

enter image description here

Answered By – Ravinder Kumar

Answer Checked By – David Goodson (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published.