This commit is contained in:
Hillel Coren 2020-02-14 14:44:20 +02:00
parent 720b05925f
commit 8cfaa34a50
2 changed files with 44 additions and 28 deletions

View File

@ -193,13 +193,10 @@ class ReportsScreen extends StatelessWidget {
}),
],
),
FormCard(
child: ReportDataTable(
//key: ObjectKey(viewModel.reportResult.columns),
key: ValueKey(
'${viewModel.state.isSaving} ${reportsUIState.group}'),
viewModel: viewModel,
),
ReportDataTable(
key: ValueKey(
'${viewModel.state.isSaving} ${reportsUIState.group}'),
viewModel: viewModel,
)
],
),
@ -274,27 +271,43 @@ class _ReportDataTableState extends State<ReportDataTable> {
?.reportSettings[state.uiState.reportsUIState.report] ??
ReportSettingsEntity();
return SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: DataTable(
sortColumnIndex: reportSettings.sortIndex,
sortAscending: reportSettings.sortAscending,
columns: reportResult.tableColumns(
context,
(index, ascending) =>
widget.viewModel.onReportSorted(index, ascending)),
rows: [
reportResult.tableFilters(context,
_textEditingControllers[state.uiState.reportsUIState.report],
(column, value) {
widget.viewModel.onReportFiltersChanged(
context,
state.uiState.reportsUIState.filters
.rebuild((b) => b..addAll({column: value})));
}),
...reportResult.tableRows(context),
],
),
return Column(
children: <Widget>[
FormCard(
child: DataTable(
columns: [
DataColumn(
label: Text(AppLocalization.of(context).totals),
)
],
rows: [],
),
),
FormCard(
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: DataTable(
sortColumnIndex: reportSettings.sortIndex,
sortAscending: reportSettings.sortAscending,
columns: reportResult.tableColumns(
context,
(index, ascending) =>
widget.viewModel.onReportSorted(index, ascending)),
rows: [
reportResult.tableFilters(context,
_textEditingControllers[state.uiState.reportsUIState.report],
(column, value) {
widget.viewModel.onReportFiltersChanged(
context,
state.uiState.reportsUIState.filters
.rebuild((b) => b..addAll({column: value})));
}),
...reportResult.tableRows(context),
],
),
),
),
],
);
}
}

View File

@ -14,6 +14,7 @@ abstract class LocaleCodeAware {
mixin LocalizationsProvider on LocaleCodeAware {
static final Map<String, Map<String, String>> _localizedValues = {
'en': {
'totals': 'Totals',
'blank': 'Blank',
'day': 'Day',
'month': 'Month',
@ -14600,6 +14601,8 @@ mixin LocalizationsProvider on LocaleCodeAware {
String get total => _localizedValues[localeCode]['total'];
String get totals => _localizedValues[localeCode]['totals'];
String get percent => _localizedValues[localeCode]['percent'];
String get edit => _localizedValues[localeCode]['edit'];