I have a DataTable
widget for displaying some data in tabular format. I wasn't able to find any way to change the background color of the DataColumn
, it defaults to white.
I tried wrapping the label
inside a Container
but that does not help since the container takes the dimensions of the child.
Is there any easier way to set the background color of `DataColum'?
Below is some code for reference -
DataTable(
dataRowHeight: 70,
headingRowHeight: 60,
rows: List.generate(4, (index) {
return DataRow(
cells: <DataCell>[
DataCell(
Text("Number",),
),
DataCell(
Text(
"Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
),
),
]
);
}),
columns: [
DataColumn(
label: Text("Name"),
),
DataColumn(
label: Text("Description"),
),
],
)
Now in flutter version 1.22, you can do it like this
DataTable(
headingRowColor:
MaterialStateColor.resolveWith((states) => Colors.blue),
columns: [
DataColumn(),
DataColumn(),
],
rows: [
DataRow(
cells: [
DataCell(),
DataCell(),
],
),
],
)