Unverified Commit 756a1f03 authored by William Oprandi's avatar William Oprandi Committed by GitHub

Pass showCheckboxColumn parameter to DataTable (#53655)

parent bec1b734
...@@ -474,6 +474,7 @@ class PaginatedDataTableState extends State<PaginatedDataTable> { ...@@ -474,6 +474,7 @@ class PaginatedDataTableState extends State<PaginatedDataTable> {
headingRowHeight: widget.headingRowHeight, headingRowHeight: widget.headingRowHeight,
horizontalMargin: widget.horizontalMargin, horizontalMargin: widget.horizontalMargin,
columnSpacing: widget.columnSpacing, columnSpacing: widget.columnSpacing,
showCheckboxColumn: widget.showCheckboxColumn,
rows: _getRows(_firstRowIndex, widget.rowsPerPage), rows: _getRows(_firstRowIndex, widget.rowsPerPage),
), ),
), ),
......
...@@ -726,4 +726,27 @@ void main() { ...@@ -726,4 +726,27 @@ void main() {
// Reset the surface size. // Reset the surface size.
await binding.setSurfaceSize(originalSize); await binding.setSurfaceSize(originalSize);
}); });
testWidgets('PaginatedDataTable with optional column checkbox', (WidgetTester tester) async {
await binding.setSurfaceSize(const Size(800, 800));
Widget buildTable(bool checkbox) => MaterialApp(
home: PaginatedDataTable(
header: const Text('Test table'),
source: TestDataSource(onSelectChanged: (bool value) {}),
showCheckboxColumn: checkbox,
columns: const <DataColumn>[
DataColumn(label: Text('Name')),
DataColumn(label: Text('Calories'), numeric: true),
DataColumn(label: Text('Generation')),
],
),
);
await tester.pumpWidget(buildTable(true));
expect(find.byType(Checkbox), findsNWidgets(11));
await tester.pumpWidget(buildTable(false));
expect(find.byType(Checkbox), findsNothing);
});
} }
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