WIP
This commit is contained in:
parent
fc77d67767
commit
929c18ba9e
|
@ -147,56 +147,63 @@ class PreferencesPageModel with ChangeNotifier {
|
|||
),
|
||||
FFButtonWidget(
|
||||
onPressed: () async {
|
||||
PhpGroup.changeNotifica
|
||||
.call(
|
||||
userUUID: FFAppState().userUUID,
|
||||
devUUID: FFAppState().devUUID,
|
||||
cliID: FFAppState().cliUUID,
|
||||
atividade: 'updVisitado',
|
||||
notifica: FFAppState().notify ? 'S' : 'N',
|
||||
)
|
||||
.then((value) {
|
||||
FFAppState().notify = !FFAppState().notify;
|
||||
try {
|
||||
PhpGroup.changeNotifica
|
||||
.call(
|
||||
userUUID: FFAppState().userUUID,
|
||||
devUUID: FFAppState().devUUID,
|
||||
cliID: FFAppState().cliUUID,
|
||||
atividade: 'updVisitado',
|
||||
notifica: FFAppState().notify ? 'S' : 'N',
|
||||
)
|
||||
.then((value) {
|
||||
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) {
|
||||
);
|
||||
}).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);
|
||||
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(
|
||||
enText: 'Yes',
|
||||
|
|
Loading…
Reference in New Issue