data_table_2
data_table_2 copied to clipboard
Some cells not taking 100 of physical pixels.
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.
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);
}
}
Thanks for the issue, I believe it is smth inherited from SDK (specifics of Flutter's table rendering) and is not easy to fix while not critical. Keeping it for the record