Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create table like ui in flutter

Tags:

flutter

dart

I am new in flutter just want to know using which widget i can create ui like given in below image.

enter image description here

Thanks,

like image 554
ketan Avatar asked Jun 25 '19 10:06

ketan


People also ask

How do you create a Table layout in flutter?

First, we need to add a Table widget in the body. Next, we have to add TableRow(s) in children of the table widget. Since the table widget has multiple rows, so we use children, not child. Finally, we need to add TableCell(s) in children of TableRow widget.

How do you display a Table in flutter?

Table widget is used to display items in a table layout. There is no need to use Rows and Columns to create a table. If we have multiple rows with the same width of columns then Table widget is the right approach.

How do I create a dynamic Table in flutter?

dynamicTable. add(TableRow( children: [ Text("test1"), Text("test2"), Text("test3"), ] ));


2 Answers

Flutter has a Table class for this (but you can also do it using simple Row + Column combo).

Here's the link to the Table docs: Flutter Table

Here's a simple example to get you started:

Container(
        color: Colors.white,
        padding: EdgeInsets.all(20.0),
        child: Table(
          border: TableBorder.all(color: Colors.black),
          children: [
            TableRow(children: [
              Text('Cell 1'),
              Text('Cell 2'),
              Text('Cell 3'),
            ]),
            TableRow(children: [
              Text('Cell 4'),
              Text('Cell 5'),
              Text('Cell 6'),
            ])
          ],
        ),
      )
like image 69
Thepeanut Avatar answered Oct 15 '22 16:10

Thepeanut


You can use DataTable widget. This sample shows how to display a DataTable with three columns: name, age, and role.

enter image description here

like image 39
erdogan Avatar answered Oct 15 '22 16:10

erdogan