Search code examples
flutterdart

Adding some space between TableRows in Flutter


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,
        ),
      ])
    ],
);

Solution

  • 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: