i'm creating a table in Flutter which contains some TableRows, i just want to add some space between these rows.
Table(
columnWidths: {0: FractionColumnWidth(.4)},
children:[
TableRow(children: [
Text(
'Original Title',
),
Text(
original_title,
),
]),
TableRow(children: [
Text(
'Original Language',
),
Text(
original_language,
),
])
],
);
Here's how i did it.
Create a constant, lets say rowSpacer
as
const rowSpacer=TableRow(
children: [
SizedBox(
height: 8,
),
SizedBox(
height: 8,
)
]);
Remember the number of SizedBox widgets to add above should be same as the number of colums in your table. For this case I have 2 colums, hence 2 SizedBoxes.
Now use this constant to give spacing between rows.
Table(
children: [
TableRow(
children: [
Text('Name:'),
Text('Aman kumar')
]),
rowSpacer, //Using the Constant
TableRow(
children: [
Text('Date of Birth:'),
Text('September 27, 1998')
]),
)
Probably not the most efficient way but you can wrap the TableRow in a Padding Class
Padding(
padding: EdgeInsets.all(8.0),
child: const Card(child: Text('Hello World!')),
)
Something along the lines of:
Table(
columnWidths: {0: FractionColumnWidth(.4)},
children:[
TableRow(children: [
Padding(
padding: EdgeInsets.symmetric(vertical: 8.0)
child: Text(
'Original Title',
)),
Padding(
padding: EdgeInsets.symmetric(vertical: 8.0)
child: Text(
original_title,
)),
]),
TableRow(children: [
Padding(
padding: EdgeInsets.symmetric(vertical: 8.0)
child: Text(
'Original Language',
)),
Padding(
padding: EdgeInsets.symmetric(vertical: 8.0)
child: Text(
original_language,
)),
]),
],
);
Padding Class:
EdgeInsets Class:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With