Dashboard overview

This commit is contained in:
Hillel Coren 2022-08-12 16:14:29 +03:00
parent 8d7cb401cf
commit 5a8c2fd9f9
1 changed files with 120 additions and 72 deletions

View File

@ -204,20 +204,9 @@ class DashboardPanels extends StatelessWidget {
showDialog<AlertDialog>(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: Text(localization.settings),
key: ValueKey(
'__${settings.includeTaxes}_${settings.currencyId}__'),
actions: [
TextButton(
child: Text(localization.close.toUpperCase()),
onPressed: () => Navigator.of(context).pop(),
)
],
content: _DashboardSettings(
return _DashboardSettings(
isWide: isWide,
viewModel: viewModel,
),
);
});
}
@ -1060,7 +1049,16 @@ class __DashboardSettingsState extends State<_DashboardSettings> {
);
}
return SingleChildScrollView(
return AlertDialog(
title: Text(localization.settings),
actions: [
TextButton(
child: Text(localization.close.toUpperCase()),
onPressed: () => Navigator.of(context).pop(),
)
],
content: Container(
width: 300,
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
@ -1091,8 +1089,53 @@ class __DashboardSettingsState extends State<_DashboardSettings> {
),
SizedBox(height: 10),
],
Expanded(
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),
@ -1104,6 +1147,10 @@ class __DashboardSettingsState extends State<_DashboardSettings> {
},
),
),
*/
],
),
),
AppButton(
label: localization.addField,
onPressed: () async {
@ -1129,6 +1176,7 @@ class __DashboardSettingsState extends State<_DashboardSettings> {
.toList())
],
),
),
);
}
}