Add horizontal scrolling to reports
This commit is contained in:
parent
f37970f69a
commit
0f4ff64e6a
|
|
@ -1,5 +1,6 @@
|
|||
// Flutter imports:
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/material.dart' hide DataRow, DataCell, DataColumn;
|
||||
import 'package:flutter/material.dart' as mt;
|
||||
|
||||
// Package imports:
|
||||
import 'package:flutter_redux/flutter_redux.dart';
|
||||
|
|
@ -30,6 +31,9 @@ import 'package:invoiceninja_flutter/ui/app/history_drawer_vm.dart';
|
|||
import 'package:invoiceninja_flutter/ui/app/menu_drawer_vm.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/presenters/entity_presenter.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/scrollable_listview.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/tables/app_data_table.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/tables/app_data_table_source.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/tables/app_paginated_data_table.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/upgrade_dialog.dart';
|
||||
import 'package:invoiceninja_flutter/ui/reports/report_charts.dart';
|
||||
import 'package:invoiceninja_flutter/ui/reports/reports_screen_vm.dart';
|
||||
|
|
@ -671,8 +675,8 @@ class _ReportDataTableState extends State<ReportDataTable> {
|
|||
),
|
||||
SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: PaginatedDataTable(
|
||||
showFirstLastButtons: true,
|
||||
child: AppPaginatedDataTable(
|
||||
//showFirstLastButtons: true,
|
||||
header: SizedBox(),
|
||||
sortColumnIndex: sortedColumns.contains(reportSettings.sortColumn)
|
||||
? sortedColumns.indexOf(reportSettings.sortColumn)
|
||||
|
|
@ -700,7 +704,7 @@ class TotalsDataTable extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return DataTable(
|
||||
return mt.DataTable(
|
||||
sortColumnIndex: reportSettings.sortTotalsIndex != null &&
|
||||
reportResult.columns.length > reportSettings.sortTotalsIndex
|
||||
? reportSettings.sortTotalsIndex
|
||||
|
|
@ -776,7 +780,7 @@ ReportColumnType getReportColumnType(String column, BuildContext context) {
|
|||
}
|
||||
}
|
||||
|
||||
class ReportDataTableSource extends DataTableSource {
|
||||
class ReportDataTableSource extends AppDataTableSource {
|
||||
ReportDataTableSource({
|
||||
@required this.context,
|
||||
@required this.textEditingControllers,
|
||||
|
|
@ -1415,7 +1419,7 @@ class ReportResult {
|
|||
}
|
||||
}
|
||||
|
||||
List<DataColumn> totalColumns(
|
||||
List<mt.DataColumn> totalColumns(
|
||||
BuildContext context, Function(int, bool) onSortCallback) {
|
||||
final store = StoreProvider.of<AppState>(context);
|
||||
final company = store.state.company;
|
||||
|
|
@ -1429,11 +1433,11 @@ class ReportResult {
|
|||
// print('## $column => ${getReportColumnType(column, context)}');
|
||||
|
||||
final totalColumns = [
|
||||
DataColumn(
|
||||
mt.DataColumn(
|
||||
label: Text(localization.currency),
|
||||
onSort: onSortCallback,
|
||||
),
|
||||
DataColumn(
|
||||
mt.DataColumn(
|
||||
label: Text(localization.count),
|
||||
onSort: onSortCallback,
|
||||
),
|
||||
|
|
@ -1443,7 +1447,7 @@ class ReportResult {
|
|||
ReportColumnType.age,
|
||||
ReportColumnType.duration,
|
||||
].contains(getReportColumnType(column, context)))
|
||||
DataColumn(
|
||||
mt.DataColumn(
|
||||
label: Text(
|
||||
company.getCustomFieldLabel(column).isEmpty
|
||||
? localization.lookup(column)
|
||||
|
|
@ -1460,8 +1464,8 @@ class ReportResult {
|
|||
return totalColumns;
|
||||
}
|
||||
|
||||
List<DataRow> totalRows(BuildContext context) {
|
||||
final rows = <DataRow>[];
|
||||
List<mt.DataRow> totalRows(BuildContext context) {
|
||||
final rows = <mt.DataRow>[];
|
||||
final store = StoreProvider.of<AppState>(context);
|
||||
final state = store.state;
|
||||
final reportState = state.uiState.reportsUIState;
|
||||
|
|
@ -1580,11 +1584,11 @@ class ReportResult {
|
|||
|
||||
keys.forEach((currencyId) {
|
||||
final values = totals[currencyId];
|
||||
final cells = <DataCell>[
|
||||
DataCell(Text(
|
||||
final cells = <mt.DataCell>[
|
||||
mt.DataCell(Text(
|
||||
store.state.staticState.currencyMap[currencyId]?.listDisplayName ??
|
||||
'')),
|
||||
DataCell(Text(values['count'].toInt().toString())),
|
||||
mt.DataCell(Text(values['count'].toInt().toString())),
|
||||
];
|
||||
|
||||
allFields.forEach((field) {
|
||||
|
|
@ -1603,12 +1607,12 @@ class ReportResult {
|
|||
? FormatNumberType.double
|
||||
: FormatNumberType.money);
|
||||
}
|
||||
cells.add(DataCell(Text(value)));
|
||||
cells.add(mt.DataCell(Text(value)));
|
||||
}
|
||||
});
|
||||
|
||||
//print('## Total Rows: ${cells.length}');
|
||||
rows.add(DataRow(cells: cells));
|
||||
rows.add(mt.DataRow(cells: cells));
|
||||
});
|
||||
|
||||
return rows;
|
||||
|
|
|
|||
Loading…
Reference in New Issue