diff --git a/lib/pages/preferences_settings_page/preferences_settings_model.dart b/lib/pages/preferences_settings_page/preferences_settings_model.dart index 537fca14..edbb049e 100644 --- a/lib/pages/preferences_settings_page/preferences_settings_model.dart +++ b/lib/pages/preferences_settings_page/preferences_settings_model.dart @@ -157,27 +157,32 @@ class PreferencesPageModel with ChangeNotifier { notifica: FFAppState().notify ? 'S' : 'N', ) .then((value) { - FFAppState().notify = !FFAppState().notify; + if (value.jsonBody['error'] == false) { + Navigator.pop(context); + FFAppState().notify = !FFAppState().notify; - ScaffoldMessenger.of(context).showSnackBar( - SnackBar( - content: Text( - FFLocalizations.of(context).getVariableText( - ptText: 'Notificação alterada com sucesso', - enText: 'Notification changed successfully', - ), - style: TextStyle( - color: - FlutterFlowTheme.of(context).info)), - backgroundColor: - FlutterFlowTheme.of(context).success, - duration: const Duration(seconds: 3), - behavior: SnackBarBehavior.floating, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(30), + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text( + FFLocalizations.of(context).getVariableText( + ptText: + 'Notificação alterada com sucesso', + enText: + 'Notification changed successfully', + ), + style: TextStyle( + color: + FlutterFlowTheme.of(context).info)), + backgroundColor: + FlutterFlowTheme.of(context).success, + duration: const Duration(seconds: 3), + behavior: SnackBarBehavior.floating, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(30), + ), ), - ), - ); + ); + } }).catchError((err) { Navigator.pop(context); ScaffoldMessenger.of(context).showSnackBar(