Reports
This commit is contained in:
parent
d9461c7205
commit
649157478b
|
|
@ -11,6 +11,7 @@ void multiselectDialog(
|
|||
List<String> selected,
|
||||
Function(List<String>) onSelected}) {
|
||||
final localization = AppLocalization.of(context);
|
||||
List<String> selected;
|
||||
|
||||
showDialog<AlertDialog>(
|
||||
context: context,
|
||||
|
|
@ -21,6 +22,7 @@ void multiselectDialog(
|
|||
options: options,
|
||||
selected: selected,
|
||||
addTitle: addTitle,
|
||||
onSelected: (values) => selected = values,
|
||||
),
|
||||
actions: <Widget>[
|
||||
FlatButton(
|
||||
|
|
@ -32,7 +34,7 @@ void multiselectDialog(
|
|||
child: Text(localization.save.toUpperCase()),
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
onSelected(['']);
|
||||
onSelected(selected);
|
||||
})
|
||||
],
|
||||
),
|
||||
|
|
@ -40,11 +42,13 @@ void multiselectDialog(
|
|||
}
|
||||
|
||||
class _MultiSelectList extends StatefulWidget {
|
||||
const _MultiSelectList({this.options, this.selected, this.addTitle});
|
||||
const _MultiSelectList(
|
||||
{this.options, this.selected, this.addTitle, this.onSelected});
|
||||
|
||||
final List<String> options;
|
||||
final List<String> selected;
|
||||
final String addTitle;
|
||||
final Function(List<String>) onSelected;
|
||||
|
||||
@override
|
||||
_MultiSelectListState createState() => _MultiSelectListState();
|
||||
|
|
@ -56,7 +60,7 @@ class _MultiSelectListState extends State<_MultiSelectList> {
|
|||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
selected = widget.selected;
|
||||
selected = widget.selected ?? [];
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
@ -84,6 +88,7 @@ class _MultiSelectListState extends State<_MultiSelectList> {
|
|||
}
|
||||
setState(() {
|
||||
selected.add(value);
|
||||
widget.onSelected(selected);
|
||||
});
|
||||
},
|
||||
),
|
||||
|
|
@ -129,6 +134,7 @@ class _MultiSelectListState extends State<_MultiSelectList> {
|
|||
final field = selected[oldIndex];
|
||||
selected.remove(field);
|
||||
selected.insert(newIndex, field);
|
||||
widget.onSelected(selected);
|
||||
});
|
||||
},
|
||||
),
|
||||
|
|
|
|||
|
|
@ -14,8 +14,10 @@ ReportResult clientReport({
|
|||
final List<List<ReportElement>> data = [];
|
||||
BuiltList<String> columns;
|
||||
|
||||
if (userCompany.settings.reportColumns.containsKey(kReportClient)) {
|
||||
columns = userCompany.settings.reportColumns[kReportClient];
|
||||
final reportColumns = userCompany.settings.reportColumns;
|
||||
|
||||
if (reportColumns != null && reportColumns.containsKey(kReportClient)) {
|
||||
columns = reportColumns[kReportClient];
|
||||
} else {
|
||||
columns = BuiltList(<String>[
|
||||
ClientFields.name,
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ class ReportsScreen extends StatelessWidget {
|
|||
final store = StoreProvider.of<AppState>(context);
|
||||
final state = viewModel.state;
|
||||
final reportsUIState = state.uiState.reportsUIState;
|
||||
final reportResult = viewModel.reportResult;
|
||||
|
||||
return WillPopScope(
|
||||
onWillPop: () async {
|
||||
|
|
@ -130,17 +131,8 @@ class ReportsScreen extends StatelessWidget {
|
|||
onSelected: (selected) {
|
||||
print('## ON SELECTED: $selected');
|
||||
},
|
||||
options: [
|
||||
'one',
|
||||
'two',
|
||||
'three',
|
||||
'four',
|
||||
],
|
||||
selected: [
|
||||
'one',
|
||||
'two',
|
||||
'three',
|
||||
],
|
||||
options: reportResult.allColumns,
|
||||
selected: reportResult.columns,
|
||||
title: localization.editColumns,
|
||||
addTitle: localization.addColumn,
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in New Issue