data_table_2 icon indicating copy to clipboard operation
data_table_2 copied to clipboard

Some cells not taking 100 of physical pixels.

Open martinpelli opened this issue 1 year ago • 1 comments

When you try to fill cells with same color in different rows so that they look like one, depending of the value of dataRowHeight you can see white spaces.

image

minimal reproduction code:

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Material App',
      home: Scaffold(
          appBar: AppBar(),
          body: DataTable2(
            fixedColumnsColor: Colors.green,
            headingRowColor: MaterialStateProperty.all(Colors.blue),
            horizontalMargin: 0,
            dataRowHeight: 70, //changing this value makes white spaces appear/disappears
            dividerThickness: 0,
            columns: const [DataColumn(label: Text('Test spacing'))],
            rows: const [
              DataRow(cells: [DataCell(_ColoredContainer())]),
              DataRow(cells: [DataCell(_ColoredContainer())]),
              DataRow(cells: [DataCell(_ColoredContainer())]),
              DataRow(cells: [DataCell(_ColoredContainer())]),
              DataRow(cells: [DataCell(_ColoredContainer())]),
              DataRow(cells: [DataCell(_ColoredContainer())]),
            ],
          )),
    );
  }
}

class _ColoredContainer extends StatelessWidget {
  const _ColoredContainer({
    super.key,
  });

  @override
  Widget build(BuildContext context) {
    return Container(width: double.infinity, height: double.infinity, color: Colors.red);
  }
}

martinpelli avatar Feb 04 '23 19:02 martinpelli