From 1da4899d5ad431f0f5b835d5d207a4bc9dad56ce Mon Sep 17 00:00:00 2001 From: jantunesmesias Date: Thu, 8 Aug 2024 08:50:20 -0300 Subject: [PATCH] WIP --- .../preferences_settings_model.dart | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/lib/pages/preferences_settings_page/preferences_settings_model.dart b/lib/pages/preferences_settings_page/preferences_settings_model.dart index edbb049e..624a8b0a 100644 --- a/lib/pages/preferences_settings_page/preferences_settings_model.dart +++ b/lib/pages/preferences_settings_page/preferences_settings_model.dart @@ -157,8 +157,8 @@ class PreferencesPageModel with ChangeNotifier { notifica: FFAppState().notify ? 'S' : 'N', ) .then((value) { + Navigator.pop(context); if (value.jsonBody['error'] == false) { - Navigator.pop(context); FFAppState().notify = !FFAppState().notify; ScaffoldMessenger.of(context).showSnackBar( @@ -182,6 +182,26 @@ class PreferencesPageModel with ChangeNotifier { ), ), ); + } else { + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text( + FFLocalizations.of(context).getVariableText( + ptText: 'Erro ao alterar notificação', + enText: 'Error changing notification', + ), + style: TextStyle( + color: + FlutterFlowTheme.of(context).info)), + backgroundColor: + FlutterFlowTheme.of(context).error, + duration: const Duration(seconds: 3), + behavior: SnackBarBehavior.floating, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(30), + ), + ), + ); } }).catchError((err) { Navigator.pop(context);