diff --git a/lib/widgets/submit_form_button.dart b/lib/widgets/submit_form_button.dart index b5bb593..4c98c34 100644 --- a/lib/widgets/submit_form_button.dart +++ b/lib/widgets/submit_form_button.dart @@ -1,5 +1,7 @@ import 'package:awesome_dialog/awesome_dialog.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; +import 'package:smoke_cess_app/providers/page_provider.dart'; class SubmitFormButton extends StatelessWidget { final Future Function() submitCallback; @@ -9,21 +11,23 @@ class SubmitFormButton extends StatelessWidget { @override Widget build(BuildContext context) { + PageProvider pageProvider = context.watch(); return Padding( padding: const EdgeInsets.symmetric(vertical: 16.0), child: ElevatedButton( onPressed: () async { int success = await submitCallback(); if (success != 0) { - AwesomeDialog( + await AwesomeDialog( context: context, dialogType: DialogType.success, title: 'Gespeichert', desc: 'Der Eintrag wurde erfolgreich gespeichert', ).show(); updateTasks(); + pageProvider.swap(); } else { - AwesomeDialog( + await AwesomeDialog( context: context, dialogType: DialogType.error, title: 'Fehler',