Correct invoicing tasks

This commit is contained in:
Hillel Coren 2022-08-12 16:22:47 +03:00
parent 8de5fd1f46
commit 0f1a5c8812
1 changed files with 11 additions and 32 deletions

View File

@ -1092,16 +1092,24 @@ class __DashboardSettingsState extends State<_DashboardSettings> {
Expanded( Expanded(
child: ReorderableListView( child: ReorderableListView(
onReorder: (oldIndex, newIndex) { onReorder: (oldIndex, newIndex) {
final fields = settings.totalFields;
// https://stackoverflow.com/a/54164333/497368 // https://stackoverflow.com/a/54164333/497368
// These two lines are workarounds for ReorderableListView problems // These two lines are workarounds for ReorderableListView problems
if (newIndex > settings.totalFields.length) { if (newIndex > fields.length) {
newIndex = settings.totalFields.length; newIndex = fields.length;
} }
if (oldIndex < newIndex) { if (oldIndex < newIndex) {
newIndex--; newIndex--;
} }
// final field = fields[oldIndex];
store.dispatch(UpdateDashboardSettings(
totalFields: fields.rebuild((b) => b
..removeAt(oldIndex)
..insert(newIndex, field))));
setState(() {});
}, },
children: [ children: [
for (var dashboardField in settings.totalFields) for (var dashboardField in settings.totalFields)
@ -1121,35 +1129,6 @@ class __DashboardSettingsState extends State<_DashboardSettings> {
}, },
), ),
), ),
/*
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(
localization.lookup(dashboardField.field),
textAlign: TextAlign.left,
style: Theme.of(context).textTheme.subtitle1,
),
),
],
),
),
*/
], ],
), ),
), ),