Table Widget in Flutter

Updated 27 April 2023

Save

Table Widget in Flutter is used to show our data in a structured format.

If we want our data to be shown horizontally, we prefer using the Row widget.

If we want to display our data in a single column, we prefer using Column Widget.

When we want to display the data horizontally as well as vertically, the Table widget is the one that is preferred.

Check out more about Flutter app development services by Mobikul.

Some Properties of Table widget

children => This property takes a list of table row as a parameter List<TableRow>. TableRow contains a list of widgets as children.

columnWidths => This property determines the width of the columns in the Table widget

textDirection => It is used to define the direction in which columns are ordered in Table. It can be either from left-to-right or from right-to-left.

defaultColumnWidth => This property takes in TableColumnWidth class as the input parameter to set the default width of the column in the Table widget.

border => This property takes TableBorder widget as the parameter and it sets the border for the table. By default, there is no border.

defaultVerticalAlignment => This property takes TableCellVerticalAlignment as the parameter value to sets the alignment of cells vertically in the table.

textBaseline => Using this property we can specify a horizontal line uses to align text on the screen inside the Table widget.

This is the basic structure of our app after writing out the basic code, but we know that it is not looking good

So, in order to make our UI look better, we will add a border to the table with the help of Border property.

For providing different column widths to each column we have a property named columnWidths

As a result, we will get the columns with different column widths.

Conclusion

In this blog, we have discussed Table Widget in Flutter.

I hope this blog will help you in getting some basic knowledge about this widget.

You may also check our other blogs – https://mobikul.com/blog/

Thank you for reading!!

author
. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


Be the first to comment.

Start a Project


    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home