diff --git a/packages/flutter/lib/src/material/paginated_data_table.dart b/packages/flutter/lib/src/material/paginated_data_table.dart index 06140bebb8f..eb04e9d00ce 100644 --- a/packages/flutter/lib/src/material/paginated_data_table.dart +++ b/packages/flutter/lib/src/material/paginated_data_table.dart @@ -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. /// diff --git a/packages/flutter/test/material/paginated_data_table_test.dart b/packages/flutter/test/material/paginated_data_table_test.dart index db7335627d4..53c289e8b18 100644 --- a/packages/flutter/test/material/paginated_data_table_test.dart +++ b/packages/flutter/test/material/paginated_data_table_test.dart @@ -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(label: Text('Name')), + DataColumn(label: Text('Calories'), numeric: true), + DataColumn(label: Text('Generation')), + ], + ), + )); + + final Container rowContainer = tester.widget(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;