Unverified Commit 1b1c8a16 authored by Mark O'Sullivan's avatar Mark O'Sullivan Committed by GitHub

Fixed `PaginatedDataTable` not using `dataRowMinHeight` and `dataRowMaxHeight` from Theme (#133634)

`PaginatedDataTable` will now make use of `dataRowMinHeight` and `dataRowMaxHeight` from the Theme

*List which issues are fixed by this PR. You must list at least one issue.*

Resolves #133633
parent eb77b525
......@@ -122,8 +122,8 @@ class PaginatedDataTable extends StatefulWidget {
assert(dataRowMinHeight == null || dataRowMaxHeight == null || dataRowMaxHeight >= dataRowMinHeight),
assert(dataRowHeight == null || (dataRowMinHeight == null && dataRowMaxHeight == null),
'dataRowHeight ($dataRowHeight) must not be set if dataRowMinHeight ($dataRowMinHeight) or dataRowMaxHeight ($dataRowMaxHeight) are set.'),
dataRowMinHeight = dataRowHeight ?? dataRowMinHeight ?? kMinInteractiveDimension,
dataRowMaxHeight = dataRowHeight ?? dataRowMaxHeight ?? kMinInteractiveDimension,
dataRowMinHeight = dataRowHeight ?? dataRowMinHeight,
dataRowMaxHeight = dataRowHeight ?? dataRowMaxHeight,
assert(rowsPerPage > 0),
assert(() {
if (onRowsPerPageChanged != null) {
......@@ -192,13 +192,13 @@ class PaginatedDataTable extends StatefulWidget {
///
/// This value is optional and defaults to [kMinInteractiveDimension] if not
/// specified.
final double dataRowMinHeight;
final double? dataRowMinHeight;
/// The maximum height of each row (excluding the row that contains column headings).
///
/// This value is optional and defaults to kMinInteractiveDimension if not
/// This value is optional and defaults to [kMinInteractiveDimension] if not
/// specified.
final double dataRowMaxHeight;
final double? dataRowMaxHeight;
/// The height of the heading row.
///
......
......@@ -1022,6 +1022,38 @@ void main() {
await binding.setSurfaceSize(originalSize);
});
testWidgets('dataRowMinHeight & dataRowMaxHeight if not set will use DataTableTheme', (WidgetTester tester) async {
addTearDown(() => binding.setSurfaceSize(null));
await binding.setSurfaceSize(const Size(800, 800));
const double minMaxDataRowHeight = 30.0;
await tester.pumpWidget(MaterialApp(
theme: ThemeData(
dataTableTheme: const DataTableThemeData(
dataRowMinHeight: minMaxDataRowHeight,
dataRowMaxHeight: minMaxDataRowHeight,
),
),
home: PaginatedDataTable(
header: const Text('Test table'),
source: TestDataSource(allowSelection: true),
columns: const <DataColumn>[
DataColumn(label: Text('Name')),
DataColumn(label: Text('Calories'), numeric: true),
DataColumn(label: Text('Generation')),
],
),
));
final Container rowContainer = tester.widget<Container>(find.descendant(
of: find.byType(Table),
matching: find.byType(Container),
).last);
expect(rowContainer.constraints?.minHeight, minMaxDataRowHeight);
expect(rowContainer.constraints?.maxHeight, minMaxDataRowHeight);
});
testWidgets('PaginatedDataTable custom checkboxHorizontalMargin properly applied', (WidgetTester tester) async {
const double customCheckboxHorizontalMargin = 15.0;
const double customHorizontalMargin = 10.0;
......
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