0

Is it possible to use padding inside data cell in Data Table? It seems that padding does not work inside a data cell.

DataRow(
    cells: [
      DataCell(
        buildItem(),
      ),
      const DataCell(
        Text('text'),
      ),
    ],
 ),

Widget buildItem() {
  // instead of adding real padding inside cell it reduces the SizedBox height
  return Padding(
    padding: const EdgeInsets.all(12.0), 
    child: SizedBox(
      height: 50,
      width: 80,
      child: Container(
        color: Colors.teal,
      ),
    ),
  );
}
rozerro
  • 5,787
  • 9
  • 46
  • 94

1 Answers1

0

you have to give your table a `dataRowHeight in order to work

DataTable(
        dataRowHeight: 100,
        rows: [
          DataRow(cells: <DataCell>[DataCell(buildItem())])
        ],
        columns: const [DataColumn(label: Text('label'))],
      )
john
  • 1,438
  • 8
  • 18