Correct report row count

This commit is contained in:
Hillel Coren 2023-02-23 14:32:52 +02:00
parent 0f4ff64e6a
commit a9393134b8
2 changed files with 5 additions and 1 deletions

View File

@ -72,6 +72,7 @@ class AppPaginatedDataTable extends StatefulWidget {
this.initialFirstRowIndex = 0, this.initialFirstRowIndex = 0,
this.onPageChanged, this.onPageChanged,
this.rowsPerPage = defaultRowsPerPage, this.rowsPerPage = defaultRowsPerPage,
this.subtractOneFromCount = false,
this.availableRowsPerPage = const <int>[ this.availableRowsPerPage = const <int>[
defaultRowsPerPage, defaultRowsPerPage,
defaultRowsPerPage * 2, defaultRowsPerPage * 2,
@ -214,6 +215,8 @@ class AppPaginatedDataTable extends StatefulWidget {
/// {@macro flutter.widgets.scrollable.dragStartBehavior} /// {@macro flutter.widgets.scrollable.dragStartBehavior}
final DragStartBehavior dragStartBehavior; final DragStartBehavior dragStartBehavior;
final bool subtractOneFromCount;
@override @override
AppPaginatedDataTableState createState() => AppPaginatedDataTableState(); AppPaginatedDataTableState createState() => AppPaginatedDataTableState();
} }
@ -410,7 +413,7 @@ class AppPaginatedDataTableState extends State<AppPaginatedDataTable> {
localizations.pageRowsInfoTitle( localizations.pageRowsInfoTitle(
_firstRowIndex + 1, _firstRowIndex + 1,
_firstRowIndex + widget.rowsPerPage, _firstRowIndex + widget.rowsPerPage,
_rowCount, _rowCount - (widget.subtractOneFromCount ? 1 : 0),
_rowCountApproximate, _rowCountApproximate,
), ),
), ),

View File

@ -677,6 +677,7 @@ class _ReportDataTableState extends State<ReportDataTable> {
padding: const EdgeInsets.all(12), padding: const EdgeInsets.all(12),
child: AppPaginatedDataTable( child: AppPaginatedDataTable(
//showFirstLastButtons: true, //showFirstLastButtons: true,
subtractOneFromCount: true,
header: SizedBox(), header: SizedBox(),
sortColumnIndex: sortedColumns.contains(reportSettings.sortColumn) sortColumnIndex: sortedColumns.contains(reportSettings.sortColumn)
? sortedColumns.indexOf(reportSettings.sortColumn) ? sortedColumns.indexOf(reportSettings.sortColumn)