Fix DataTableThemeData.copyWith handling of dataRowHeight (#126943)
Fixes https://github.com/flutter/flutter/issues/126676
This commit is contained in:
parent
60751ca519
commit
e24c64d8ee
@ -137,10 +137,14 @@ class DataTableThemeData with Diagnosticable {
|
|||||||
MaterialStateProperty<MouseCursor?>? headingCellCursor,
|
MaterialStateProperty<MouseCursor?>? headingCellCursor,
|
||||||
MaterialStateProperty<MouseCursor?>? dataRowCursor,
|
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(
|
return DataTableThemeData(
|
||||||
decoration: decoration ?? this.decoration,
|
decoration: decoration ?? this.decoration,
|
||||||
dataRowColor: dataRowColor ?? this.dataRowColor,
|
dataRowColor: dataRowColor ?? this.dataRowColor,
|
||||||
dataRowHeight: dataRowHeight ?? this.dataRowHeight,
|
|
||||||
dataRowMinHeight: dataRowMinHeight ?? this.dataRowMinHeight,
|
dataRowMinHeight: dataRowMinHeight ?? this.dataRowMinHeight,
|
||||||
dataRowMaxHeight: dataRowMaxHeight ?? this.dataRowMaxHeight,
|
dataRowMaxHeight: dataRowMaxHeight ?? this.dataRowMaxHeight,
|
||||||
dataTextStyle: dataTextStyle ?? this.dataTextStyle,
|
dataTextStyle: dataTextStyle ?? this.dataTextStyle,
|
||||||
|
@ -13,6 +13,16 @@ void main() {
|
|||||||
expect(const DataTableThemeData().hashCode, const DataTableThemeData().copyWith().hashCode);
|
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', () {
|
test('DataTableThemeData lerp special cases', () {
|
||||||
const DataTableThemeData data = DataTableThemeData();
|
const DataTableThemeData data = DataTableThemeData();
|
||||||
expect(identical(DataTableThemeData.lerp(data, data, 0.5), data), true);
|
expect(identical(DataTableThemeData.lerp(data, data, 0.5), data), true);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user