diff --git a/lib/pages/preferences_settings_page/preferences_settings_model.dart b/lib/pages/preferences_settings_page/preferences_settings_model.dart index c26d7ba6..a27db0b9 100644 --- a/lib/pages/preferences_settings_page/preferences_settings_model.dart +++ b/lib/pages/preferences_settings_page/preferences_settings_model.dart @@ -45,7 +45,43 @@ class PreferencesPageModel with ChangeNotifier { ), ); }, - ).whenComplete(() => notifyListeners()); + ).then((value) { + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text( + FFLocalizations.of(context).getVariableText( + enText: 'Fingerprint changed successfully', + ptText: 'Impressão digital alterada com sucesso', + ), + 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, stack) { + log(err.toString()); + log(stack.toString()); + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text( + FFLocalizations.of(context).getVariableText( + ptText: 'Erro ao alterar impressão digital', + enText: 'Error changing fingerprint', + ), + 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), + ), + ), + ); + }).whenComplete(() => notifyListeners()); } } @@ -70,7 +106,24 @@ class PreferencesPageModel with ChangeNotifier { atividade: 'updVisitado', notifica: FFAppState().notify ? 'S' : 'N', ) - .catchError((err) { + .then((value) { + 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) { log(err.toString()); ScaffoldMessenger.of(context).showSnackBar( SnackBar( @@ -120,7 +173,8 @@ class PreferencesPageModel with ChangeNotifier { enText: 'Cancel', ptText: 'Cancelar', ), - style: TextStyle(color: FlutterFlowTheme.of(context).info), + style: TextStyle( + color: FlutterFlowTheme.of(context).primaryText), ), ), TextButton( @@ -167,7 +221,8 @@ class PreferencesPageModel with ChangeNotifier { enText: 'Unlink', ptText: 'Desvincular', ), - style: TextStyle(color: FlutterFlowTheme.of(context).info), + style: TextStyle( + color: FlutterFlowTheme.of(context).primaryText), ), ), ], @@ -202,7 +257,8 @@ class PreferencesPageModel with ChangeNotifier { enText: 'Cancel', ptText: 'Cancelar', ), - style: TextStyle(color: FlutterFlowTheme.of(context).info), + style: TextStyle( + color: FlutterFlowTheme.of(context).primaryText), ), ), TextButton( @@ -252,7 +308,8 @@ class PreferencesPageModel with ChangeNotifier { enText: 'Delete', ptText: 'Deletar', ), - style: TextStyle(color: FlutterFlowTheme.of(context).info), + style: TextStyle( + color: FlutterFlowTheme.of(context).primaryText), ), ), ], @@ -328,12 +385,45 @@ class PreferencesPageModel with ChangeNotifier { newSenha: FFAppState().accessPass, ) .then((value) { - FFAppState().pass = true; // var error = jsonDecode(value.jsonBody['error'].toString()); // log('${jsonDecode(value.jsonBody['error'].toString())}'); if (jsonDecode(value.jsonBody['error'].toString()) == false) { FFAppState().pass = true; + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text( + FFLocalizations.of(context).getVariableText( + enText: 'Access password changed successfully', + ptText: 'Senha de acesso alterada com sucesso', + ), + 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), + ), + ), + ); } else { + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text( + FFLocalizations.of(context).getVariableText( + ptText: 'Erro ao alterar senha de acesso', + enText: 'Error changing access password', + ), + 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), + ), + ), + ); FFAppState().pass = false; } }).catchError((error, StackTrace) { @@ -391,7 +481,41 @@ class PreferencesPageModel with ChangeNotifier { FFAppState().panic = true; if (jsonDecode(value.jsonBody['error'].toString()) == false) { FFAppState().panic = true; + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text( + FFLocalizations.of(context).getVariableText( + enText: 'Panic password changed successfully', + ptText: 'Senha de pânico alterada com sucesso', + ), + 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), + ), + ), + ); } else { + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text( + FFLocalizations.of(context).getVariableText( + ptText: 'Erro ao alterar senha de pânico', + enText: 'Error changing panic password', + ), + 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), + ), + ), + ); FFAppState().panic = false; } }).catchError((e, s) {