Unverified Commit 9f898ffe authored by Chinmoy's avatar Chinmoy Committed by GitHub

Added arrowHeadColor property to PaginatedDataTable (#81393)

parent d4d28554
......@@ -84,6 +84,7 @@ class PaginatedDataTable extends StatefulWidget {
this.availableRowsPerPage = const <int>[defaultRowsPerPage, defaultRowsPerPage * 2, defaultRowsPerPage * 5, defaultRowsPerPage * 10],
this.onRowsPerPageChanged,
this.dragStartBehavior = DragStartBehavior.start,
this.arrowHeadColor,
required this.source,
this.checkboxHorizontalMargin,
}) : assert(actions == null || (actions != null && header != null)),
......@@ -235,6 +236,9 @@ class PaginatedDataTable extends StatefulWidget {
/// and the content in the first data column. This value defaults to 24.0.
final double? checkboxHorizontalMargin;
/// Defines the color of the arrow heads in the footer.
final Color? arrowHeadColor;
@override
PaginatedDataTableState createState() => PaginatedDataTableState();
}
......@@ -442,27 +446,27 @@ class PaginatedDataTableState extends State<PaginatedDataTable> {
Container(width: 32.0),
if (widget.showFirstLastButtons)
IconButton(
icon: const Icon(Icons.skip_previous),
icon: Icon(Icons.skip_previous, color: widget.arrowHeadColor),
padding: EdgeInsets.zero,
tooltip: localizations.firstPageTooltip,
onPressed: _firstRowIndex <= 0 ? null : _handleFirst,
),
IconButton(
icon: const Icon(Icons.chevron_left),
icon: Icon(Icons.chevron_left, color: widget.arrowHeadColor),
padding: EdgeInsets.zero,
tooltip: localizations.previousPageTooltip,
onPressed: _firstRowIndex <= 0 ? null : _handlePrevious,
),
Container(width: 24.0),
IconButton(
icon: const Icon(Icons.chevron_right),
icon: Icon(Icons.chevron_right, color: widget.arrowHeadColor),
padding: EdgeInsets.zero,
tooltip: localizations.nextPageTooltip,
onPressed: _isNextPageUnavailable() ? null : _handleNext,
),
if (widget.showFirstLastButtons)
IconButton(
icon: const Icon(Icons.skip_next),
icon: Icon(Icons.skip_next, color: widget.arrowHeadColor),
padding: EdgeInsets.zero,
tooltip: localizations.lastPageTooltip,
onPressed: _isNextPageUnavailable()
......
......@@ -974,4 +974,32 @@ void main() {
await binding.setSurfaceSize(null);
});
testWidgets('PaginatedDataTable arrowHeadColor set properly', (WidgetTester tester) async {
await binding.setSurfaceSize(const Size(800, 800));
const Color arrowHeadColor = Color(0xFFE53935);
await tester.pumpWidget(
MaterialApp(
home: PaginatedDataTable(
arrowHeadColor: arrowHeadColor,
showFirstLastButtons: true,
header: const Text('Test table'),
source: TestDataSource(),
columns: const <DataColumn>[
DataColumn(label: Text('Name')),
DataColumn(label: Text('Calories'), numeric: true),
DataColumn(label: Text('Generation')),
],
),
)
);
final Iterable<Icon> icons = tester.widgetList(find.byType(Icon));
expect(icons.elementAt(0).color, arrowHeadColor);
expect(icons.elementAt(1).color, arrowHeadColor);
expect(icons.elementAt(2).color, arrowHeadColor);
expect(icons.elementAt(3).color, arrowHeadColor);
});
}
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