Unverified Commit e24c64d8 authored by Jason Simmons's avatar Jason Simmons Committed by GitHub

Fix DataTableThemeData.copyWith handling of dataRowHeight (#126943)

Fixes https://github.com/flutter/flutter/issues/126676
parent 60751ca5
......@@ -137,10 +137,14 @@ class DataTableThemeData with Diagnosticable {
MaterialStateProperty<MouseCursor?>? headingCellCursor,
MaterialStateProperty<MouseCursor?>? dataRowCursor,
}) {
assert(dataRowHeight == null || (dataRowMinHeight == null && dataRowMaxHeight == null),
'dataRowHeight ($dataRowHeight) must not be set if dataRowMinHeight ($dataRowMinHeight) or dataRowMaxHeight ($dataRowMaxHeight) are set.');
dataRowMinHeight = dataRowHeight ?? dataRowMinHeight;
dataRowMaxHeight = dataRowHeight ?? dataRowMaxHeight;
return DataTableThemeData(
decoration: decoration ?? this.decoration,
dataRowColor: dataRowColor ?? this.dataRowColor,
dataRowHeight: dataRowHeight ?? this.dataRowHeight,
dataRowMinHeight: dataRowMinHeight ?? this.dataRowMinHeight,
dataRowMaxHeight: dataRowMaxHeight ?? this.dataRowMaxHeight,
dataTextStyle: dataTextStyle ?? this.dataTextStyle,
......
......@@ -13,6 +13,16 @@ void main() {
expect(const DataTableThemeData().hashCode, const DataTableThemeData().copyWith().hashCode);
});
test('DataTableThemeData copyWith dataRowHeight', () {
const DataTableThemeData themeData = DataTableThemeData(
dataRowMinHeight: 10,
dataRowMaxHeight: 10,
);
expect(themeData, themeData.copyWith());
expect(themeData.copyWith(dataRowMinHeight: 20, dataRowMaxHeight: 20),
themeData.copyWith(dataRowHeight: 20));
});
test('DataTableThemeData lerp special cases', () {
const DataTableThemeData data = DataTableThemeData();
expect(identical(DataTableThemeData.lerp(data, data, 0.5), data), true);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment