Dashboard overview
This commit is contained in:
parent
8d7cb401cf
commit
5a8c2fd9f9
|
|
@ -204,20 +204,9 @@ class DashboardPanels extends StatelessWidget {
|
||||||
showDialog<AlertDialog>(
|
showDialog<AlertDialog>(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return AlertDialog(
|
return _DashboardSettings(
|
||||||
title: Text(localization.settings),
|
isWide: isWide,
|
||||||
key: ValueKey(
|
viewModel: viewModel,
|
||||||
'__${settings.includeTaxes}_${settings.currencyId}__'),
|
|
||||||
actions: [
|
|
||||||
TextButton(
|
|
||||||
child: Text(localization.close.toUpperCase()),
|
|
||||||
onPressed: () => Navigator.of(context).pop(),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
content: _DashboardSettings(
|
|
||||||
isWide: isWide,
|
|
||||||
viewModel: viewModel,
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -1060,74 +1049,133 @@ class __DashboardSettingsState extends State<_DashboardSettings> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return SingleChildScrollView(
|
return AlertDialog(
|
||||||
child: Column(
|
title: Text(localization.settings),
|
||||||
mainAxisSize: MainAxisSize.min,
|
actions: [
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
TextButton(
|
||||||
children: [
|
child: Text(localization.close.toUpperCase()),
|
||||||
if (!widget.isWide) ...[
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
Row(
|
)
|
||||||
children: [
|
],
|
||||||
Text(localization.groupBy),
|
content: Container(
|
||||||
Spacer(),
|
width: 300,
|
||||||
groupBy,
|
child: Column(
|
||||||
],
|
mainAxisSize: MainAxisSize.min,
|
||||||
),
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
if (hasMultipleCurrencies)
|
children: [
|
||||||
|
if (!widget.isWide) ...[
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Text(localization.currency),
|
Text(localization.groupBy),
|
||||||
Spacer(),
|
Spacer(),
|
||||||
currencySettings,
|
groupBy,
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
if (company.hasTaxes)
|
if (hasMultipleCurrencies)
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Text(localization.taxes),
|
Text(localization.currency),
|
||||||
Spacer(),
|
Spacer(),
|
||||||
taxSettings,
|
currencySettings,
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
SizedBox(height: 10),
|
if (company.hasTaxes)
|
||||||
],
|
Row(
|
||||||
for (var dashboardField in settings.totalFields)
|
children: [
|
||||||
ListTile(
|
Text(localization.taxes),
|
||||||
title: Text(localization.lookup(dashboardField.field)),
|
Spacer(),
|
||||||
trailing: IconButton(
|
taxSettings,
|
||||||
icon: Icon(Icons.close),
|
],
|
||||||
onPressed: () {
|
),
|
||||||
store.dispatch(UpdateDashboardSettings(
|
SizedBox(height: 10),
|
||||||
totalFields: settings.totalFields
|
],
|
||||||
.rebuild((b) => b..remove(dashboardField))));
|
Expanded(
|
||||||
setState(() {});
|
child: ReorderableListView(
|
||||||
|
onReorder: (oldIndex, newIndex) {
|
||||||
|
// https://stackoverflow.com/a/54164333/497368
|
||||||
|
// These two lines are workarounds for ReorderableListView problems
|
||||||
|
if (newIndex > settings.totalFields.length) {
|
||||||
|
newIndex = settings.totalFields.length;
|
||||||
|
}
|
||||||
|
if (oldIndex < newIndex) {
|
||||||
|
newIndex--;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
},
|
},
|
||||||
|
children: [
|
||||||
|
for (var dashboardField in settings.totalFields)
|
||||||
|
Padding(
|
||||||
|
key: ValueKey(
|
||||||
|
'__${dashboardField.field}_${dashboardField.period}_'),
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
vertical: 3, horizontal: 10),
|
||||||
|
child: Row(
|
||||||
|
children: <Widget>[
|
||||||
|
IconButton(
|
||||||
|
icon: Icon(Icons.close),
|
||||||
|
onPressed: () {
|
||||||
|
store.dispatch(UpdateDashboardSettings(
|
||||||
|
totalFields: settings.totalFields.rebuild(
|
||||||
|
(b) => b..remove(dashboardField))));
|
||||||
|
setState(() {});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SizedBox(width: 20),
|
||||||
|
Expanded(
|
||||||
|
child: Text(
|
||||||
|
'test',
|
||||||
|
textAlign: TextAlign.left,
|
||||||
|
style: Theme.of(context).textTheme.subtitle1,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
/*
|
||||||
|
ListTile(
|
||||||
|
key: ValueKey(
|
||||||
|
'__${dashboardField.field}_${dashboardField.period}_'),
|
||||||
|
title: Text(localization.lookup(dashboardField.field)),
|
||||||
|
trailing: IconButton(
|
||||||
|
icon: Icon(Icons.close),
|
||||||
|
onPressed: () {
|
||||||
|
store.dispatch(UpdateDashboardSettings(
|
||||||
|
totalFields: settings.totalFields
|
||||||
|
.rebuild((b) => b..remove(dashboardField))));
|
||||||
|
setState(() {});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
*/
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
AppButton(
|
AppButton(
|
||||||
label: localization.addField,
|
label: localization.addField,
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
await showDialog<void>(
|
await showDialog<void>(
|
||||||
context: context, builder: (context) => _DashboardField());
|
context: context, builder: (context) => _DashboardField());
|
||||||
setState(() {});
|
|
||||||
},
|
|
||||||
),
|
|
||||||
SizedBox(height: 16),
|
|
||||||
AppDropdownButton<int>(
|
|
||||||
labelText: localization.fieldsPerRow,
|
|
||||||
value: settings.numberFieldsPerRow,
|
|
||||||
onChanged: (dynamic value) {
|
|
||||||
store.dispatch(
|
|
||||||
UpdateDashboardSettings(numberFieldsPerRow: value));
|
|
||||||
setState(() {});
|
setState(() {});
|
||||||
},
|
},
|
||||||
items: List<int>.generate(8, (i) => i + 1)
|
),
|
||||||
.map((value) => DropdownMenuItem<int>(
|
SizedBox(height: 16),
|
||||||
child: Text('$value'),
|
AppDropdownButton<int>(
|
||||||
value: value,
|
labelText: localization.fieldsPerRow,
|
||||||
))
|
value: settings.numberFieldsPerRow,
|
||||||
.toList())
|
onChanged: (dynamic value) {
|
||||||
],
|
store.dispatch(
|
||||||
|
UpdateDashboardSettings(numberFieldsPerRow: value));
|
||||||
|
setState(() {});
|
||||||
|
},
|
||||||
|
items: List<int>.generate(8, (i) => i + 1)
|
||||||
|
.map((value) => DropdownMenuItem<int>(
|
||||||
|
child: Text('$value'),
|
||||||
|
value: value,
|
||||||
|
))
|
||||||
|
.toList())
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue