I'm new to flutter.
I have a Datatable with data, but not all data is the same length, some are bigger than others. So my question is, can the height of the rows be made dynamic to fit the length of the data?
I know that there is a dataRowHeight property, but if I adjust it to show the longest data, the small ones have a very noticeable white space and it does not work for me.
Here is simple solution.
Give infinity height to dataRowMaxHeight
dataRowMaxHeight: double.infinity, // For dynamic row content height.
Example
DataTable(
dataRowMaxHeight: double.infinity,
columns: const [
// Your column data
DataColumn(label: Text("Column Heading")),
],
rows: [
DataCell(
SizedBox(
width: 100, // <- Give Here width of column as per your need.
child: Text(
"Long text here",
),
),
),
],
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With