@@ -338,52 +338,62 @@ class _SlotEntryFormState extends State<SlotEntryForm> {
338
338
setState (() => isSaving = true );
339
339
340
340
// Process new, edited or entries to be deleted
341
- await Future .wait ([
342
- provider.handleConfig (
343
- widget.entry,
344
- setsSliderValue == 0 ? '' : setsSliderValue.round ().toString (),
345
- ConfigType .sets,
346
- ),
347
- provider.handleConfig (
348
- widget.entry,
349
- weightController.text,
350
- ConfigType .weight,
351
- ),
352
- provider.handleConfig (
353
- widget.entry,
354
- maxWeightController.text,
355
- ConfigType .maxWeight,
356
- ),
357
- provider.handleConfig (
358
- widget.entry,
359
- repetitionsController.text,
360
- ConfigType .repetitions,
361
- ),
362
- provider.handleConfig (
363
- widget.entry,
364
- maxRepetitionsController.text,
365
- ConfigType .maxRepetitions,
366
- ),
367
- provider.handleConfig (
368
- widget.entry,
369
- restController.text,
370
- ConfigType .rest,
371
- ),
372
- provider.handleConfig (
373
- widget.entry,
374
- maxRestController.text,
375
- ConfigType .maxRest,
376
- ),
377
- provider.handleConfig (
378
- widget.entry,
379
- rirController.text,
380
- ConfigType .rir,
381
- ),
382
- ]);
383
-
384
- await provider.editSlotEntry (widget.entry, widget.routineId);
385
- if (mounted) {
386
- setState (() => isSaving = false );
341
+ try {
342
+ await Future .wait ([
343
+ provider.handleConfig (
344
+ widget.entry,
345
+ setsSliderValue == 0 ? '' : setsSliderValue.round ().toString (),
346
+ ConfigType .sets,
347
+ ),
348
+ provider.handleConfig (
349
+ widget.entry,
350
+ weightController.text,
351
+ ConfigType .weight,
352
+ ),
353
+ provider.handleConfig (
354
+ widget.entry,
355
+ maxWeightController.text,
356
+ ConfigType .maxWeight,
357
+ ),
358
+ provider.handleConfig (
359
+ widget.entry,
360
+ repetitionsController.text,
361
+ ConfigType .repetitions,
362
+ ),
363
+ provider.handleConfig (
364
+ widget.entry,
365
+ maxRepetitionsController.text,
366
+ ConfigType .maxRepetitions,
367
+ ),
368
+ provider.handleConfig (
369
+ widget.entry,
370
+ restController.text,
371
+ ConfigType .rest,
372
+ ),
373
+ provider.handleConfig (
374
+ widget.entry,
375
+ maxRestController.text,
376
+ ConfigType .maxRest,
377
+ ),
378
+ provider.handleConfig (
379
+ widget.entry,
380
+ rirController.text,
381
+ ConfigType .rir,
382
+ ),
383
+ ]);
384
+
385
+ await provider.editSlotEntry (widget.entry, widget.routineId);
386
+ if (mounted) {
387
+ setState (() => isSaving = false );
388
+ }
389
+ } catch (e) {
390
+ ScaffoldMessenger .of (context).showSnackBar (
391
+ SnackBar (content: Text ('${i18n .anErrorOccurred } $e ' )),
392
+ );
393
+ } finally {
394
+ if (mounted) {
395
+ setState (() => isSaving = false );
396
+ }
387
397
}
388
398
},
389
399
child:
0 commit comments