Blank rows shown if there are not enough entries to display #492

This commit is contained in:
Hillel Coren 2023-06-01 19:17:47 +03:00
parent 7213eaf459
commit 07c075c14f
1 changed files with 10 additions and 5 deletions

View File

@ -322,9 +322,11 @@ class AppPaginatedDataTableState extends State<AppPaginatedDataTable> {
haveProgressIndicator = true;
}
}
if (row != null) {
row ??= _getBlankRowFor(index);
result.add(row);
}
}
return result;
}
@ -378,6 +380,8 @@ class AppPaginatedDataTableState extends State<AppPaginatedDataTable> {
// FOOTER
final TextStyle footerTextStyle = themeData.textTheme.bodySmall;
final List<Widget> footerWidgets = <Widget>[];
final realRowCount =
widget.subtractOneFromCount ? _rowCount - 1 : _rowCount;
if (widget.onRowsPerPageChanged != null) {
final List<Widget> availableRowsPerPage = widget.availableRowsPerPage
//.where((int value) => value <= _rowCount || value == widget.rowsPerPage)
@ -387,6 +391,7 @@ class AppPaginatedDataTableState extends State<AppPaginatedDataTable> {
child: Text('$value'),
);
}).toList();
footerWidgets.addAll(<Widget>[
Container(width: 14.0),
// to match trailing padding in case we overflow and end up scrolling
@ -413,9 +418,9 @@ class AppPaginatedDataTableState extends State<AppPaginatedDataTable> {
Container(width: 32.0),
Text(
localizations.pageRowsInfoTitle(
_firstRowIndex + 1,
_firstRowIndex + widget.rowsPerPage,
_rowCount - (widget.subtractOneFromCount ? 1 : 0),
realRowCount > 0 ? _firstRowIndex + 1 : 0,
_firstRowIndex + math.min(widget.rowsPerPage, realRowCount),
realRowCount,
_rowCountApproximate,
),
),