This commit is contained in:
jantunesmesias 2024-08-08 08:45:19 -03:00
parent fc77d67767
commit 929c18ba9e
1 changed files with 54 additions and 47 deletions

View File

@ -147,56 +147,63 @@ class PreferencesPageModel with ChangeNotifier {
), ),
FFButtonWidget( FFButtonWidget(
onPressed: () async { onPressed: () async {
PhpGroup.changeNotifica try {
.call( PhpGroup.changeNotifica
userUUID: FFAppState().userUUID, .call(
devUUID: FFAppState().devUUID, userUUID: FFAppState().userUUID,
cliID: FFAppState().cliUUID, devUUID: FFAppState().devUUID,
atividade: 'updVisitado', cliID: FFAppState().cliUUID,
notifica: FFAppState().notify ? 'S' : 'N', atividade: 'updVisitado',
) notifica: FFAppState().notify ? 'S' : 'N',
.then((value) { )
FFAppState().notify = !FFAppState().notify; .then((value) {
FFAppState().notify = !FFAppState().notify;
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
SnackBar( SnackBar(
content: Text( content: Text(
FFLocalizations.of(context).getVariableText( FFLocalizations.of(context).getVariableText(
ptText: 'Notificação alterada com sucesso', ptText: 'Notificação alterada com sucesso',
enText: 'Notification changed successfully', enText: 'Notification changed successfully',
), ),
style: TextStyle( style: TextStyle(
color: FlutterFlowTheme.of(context).info)), color:
backgroundColor: FlutterFlowTheme.of(context).info)),
FlutterFlowTheme.of(context).success, backgroundColor:
duration: const Duration(seconds: 3), FlutterFlowTheme.of(context).success,
behavior: SnackBarBehavior.floating, duration: const Duration(seconds: 3),
shape: RoundedRectangleBorder( behavior: SnackBarBehavior.floating,
borderRadius: BorderRadius.circular(30), shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(30),
),
), ),
), );
); }).catchError((err) {
}).catchError((err) { Navigator.pop(context);
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(
FFLocalizations.of(context).getVariableText(
enText: 'Error changing notification',
ptText: 'Erro ao alterar notificação',
),
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());
} on Exception catch (e) {
log(e.toString());
Navigator.pop(context); Navigator.pop(context);
ScaffoldMessenger.of(context).showSnackBar( }
SnackBar(
content: Text(
FFLocalizations.of(context).getVariableText(
enText: 'Error changing notification',
ptText: 'Erro ao alterar notificação',
),
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());
Navigator.pop(context);
}, },
text: FFLocalizations.of(context).getVariableText( text: FFLocalizations.of(context).getVariableText(
enText: 'Yes', enText: 'Yes',