I need to do the dataTable
like the style below:
CodePudding user response:
You can use Table
, like this:
Container(
color: Colors.white,
margin: EdgeInsets.all(20.0),
child: Table(
border: TableBorder.all(color: Colors.black),
children: [
TableRow(children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
'Full Name',
style: TextStyle(
fontWeight: FontWeight.bold, color: Colors.black),
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Text('Sarah'),
),
]),
TableRow(children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
'Email',
style: TextStyle(
fontWeight: FontWeight.bold, color: Colors.black),
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Text('[email protected]'),
),
])
],
),
),
You can find more about Table widget here
CodePudding user response:
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
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'),
])
],
),
)