add AlertDialog in ToggleAccessNotification

This commit is contained in:
jantunesmesias 2024-08-06 14:02:56 -03:00
parent 6188330b04
commit 6a2bda3b38
1 changed files with 162 additions and 188 deletions

View File

@ -219,7 +219,7 @@ class PreferencesPageModel with ChangeNotifier {
borderRadius: BorderRadius.circular(10),
),
),
].divide(const SizedBox(width: 2)),
],
),
],
);
@ -246,84 +246,90 @@ class PreferencesPageModel with ChangeNotifier {
),
),
actions: [
FFButtonWidget(
text: FFLocalizations.of(context).getVariableText(
enText: 'Cancel',
ptText: 'Cancelar',
),
onPressed: () {
Navigator.pop(context);
},
options: FFButtonOptions(
width: MediaQuery.of(context).size.width * 0.3,
height: MediaQuery.of(context).size.height * 0.05,
color: FlutterFlowTheme.of(context).primaryBackground,
textStyle: TextStyle(
color: FlutterFlowTheme.of(context).primaryText,
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
mainAxisSize: MainAxisSize.max,
children: [
FFButtonWidget(
text: FFLocalizations.of(context).getVariableText(
enText: 'Cancel',
ptText: 'Cancelar',
),
borderSide: BorderSide(
color: FlutterFlowTheme.of(context).primaryBackground,
width: 1,
),
borderRadius: BorderRadius.circular(10)),
),
FFButtonWidget(
onPressed: () async {
PhpGroup.resopndeVinculo
.call(
userUUID: FFAppState().userUUID,
devUUID: FFAppState().devUUID,
cliID: FFAppState().cliUUID,
tarefa: 'I',
)
// ignore: body_might_complete_normally_catch_error
.catchError((err, stack) {
log(err.toString());
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(
FFLocalizations.of(context).getVariableText(
enText: 'Error unlinking device',
ptText: 'Erro ao desvincular dispositivo',
),
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),
),
),
);
}).then(
(value) {
FFAppState().deleteCliUUID();
FFAppState().deleteLocal();
FFAppState().deleteOwnerUUID();
Navigator.pop(context);
onPressed: () {
Navigator.pop(context);
},
);
notifyListeners();
},
text: FFLocalizations.of(context).getVariableText(
enText: 'Unlink',
ptText: 'Desvincular',
),
options: FFButtonOptions(
width: MediaQuery.of(context).size.width * 0.3,
height: MediaQuery.of(context).size.height * 0.05,
color: FlutterFlowTheme.of(context).primaryBackground,
textStyle: TextStyle(
color: FlutterFlowTheme.of(context).primaryText,
options: FFButtonOptions(
width: MediaQuery.of(context).size.width * 0.3,
height: MediaQuery.of(context).size.height * 0.05,
color: FlutterFlowTheme.of(context).primaryBackground,
textStyle: TextStyle(
color: FlutterFlowTheme.of(context).primaryText,
),
borderSide: BorderSide(
color: FlutterFlowTheme.of(context).primaryBackground,
width: 1,
),
borderRadius: BorderRadius.circular(10)),
),
borderSide: BorderSide(
color: FlutterFlowTheme.of(context).primaryBackground,
width: 1,
FFButtonWidget(
onPressed: () async {
PhpGroup.resopndeVinculo
.call(
userUUID: FFAppState().userUUID,
devUUID: FFAppState().devUUID,
cliID: FFAppState().cliUUID,
tarefa: 'I',
)
// ignore: body_might_complete_normally_catch_error
.catchError((err, stack) {
log(err.toString());
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(
FFLocalizations.of(context).getVariableText(
enText: 'Error unlinking device',
ptText: 'Erro ao desvincular dispositivo',
),
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),
),
),
);
}).then(
(value) {
FFAppState().deleteCliUUID();
FFAppState().deleteLocal();
FFAppState().deleteOwnerUUID();
Navigator.pop(context);
Navigator.pop(context);
},
);
notifyListeners();
},
text: FFLocalizations.of(context).getVariableText(
enText: 'Unlink',
ptText: 'Desvincular',
),
options: FFButtonOptions(
width: MediaQuery.of(context).size.width * 0.3,
height: MediaQuery.of(context).size.height * 0.05,
color: FlutterFlowTheme.of(context).primaryBackground,
textStyle: TextStyle(
color: FlutterFlowTheme.of(context).primaryText,
),
borderSide: BorderSide(
color: FlutterFlowTheme.of(context).primaryBackground,
width: 1,
),
borderRadius: BorderRadius.circular(10),
),
),
borderRadius: BorderRadius.circular(10),
),
],
),
],
);
@ -350,128 +356,96 @@ class PreferencesPageModel with ChangeNotifier {
),
),
actions: [
FFButtonWidget(
onPressed: () => Navigator.pop(context),
options: FFButtonOptions(
width: MediaQuery.of(context).size.width * 0.3,
height: MediaQuery.of(context).size.height * 0.05,
color: FlutterFlowTheme.of(context).primaryBackground,
textStyle: TextStyle(
color: FlutterFlowTheme.of(context).primaryText,
),
borderSide: BorderSide(
color: FlutterFlowTheme.of(context).primaryBackground,
width: 1,
),
borderRadius: BorderRadius.circular(10),
),
text: FFLocalizations.of(context).getVariableText(
enText: 'Cancel',
ptText: 'Cancelar',
),
),
FFButtonWidget(
onPressed: () {
PhpGroup.deleteAccount
.call(
devUUID: FFAppState().devUUID,
userUUID: FFAppState().userUUID,
)
.then((value) {
FFAppState().deleteAll();
FFAppState().isLogged = false;
context.goNamed(
'welcomePage',
extra: <String, dynamic>{
kTransitionInfoKey: const TransitionInfo(
hasTransition: true,
transitionType: PageTransitionType.scale,
alignment: Alignment.bottomCenter,
),
},
);
}).catchError((err) {
log(err.toString());
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(
FFLocalizations.of(context).getVariableText(
enText: 'Error deleting account',
ptText: 'Erro ao deletar conta',
),
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),
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
mainAxisSize: MainAxisSize.max,
children: [
FFButtonWidget(
onPressed: () => Navigator.pop(context),
options: FFButtonOptions(
width: MediaQuery.of(context).size.width * 0.3,
height: MediaQuery.of(context).size.height * 0.05,
color: FlutterFlowTheme.of(context).primaryBackground,
textStyle: TextStyle(
color: FlutterFlowTheme.of(context).primaryText,
),
);
});
notifyListeners();
},
options: FFButtonOptions(
width: MediaQuery.of(context).size.width * 0.3,
height: MediaQuery.of(context).size.height * 0.05,
color: FlutterFlowTheme.of(context).primaryBackground,
textStyle: TextStyle(
color: FlutterFlowTheme.of(context).primaryText,
borderSide: BorderSide(
color: FlutterFlowTheme.of(context).primaryBackground,
width: 1,
),
borderRadius: BorderRadius.circular(10),
),
text: FFLocalizations.of(context).getVariableText(
enText: 'Cancel',
ptText: 'Cancelar',
),
),
borderSide: BorderSide(
color: FlutterFlowTheme.of(context).primaryBackground,
width: 1,
FFButtonWidget(
onPressed: () {
PhpGroup.deleteAccount
.call(
devUUID: FFAppState().devUUID,
userUUID: FFAppState().userUUID,
)
.then((value) {
FFAppState().deleteAll();
FFAppState().isLogged = false;
context.goNamed(
'welcomePage',
extra: <String, dynamic>{
kTransitionInfoKey: const TransitionInfo(
hasTransition: true,
transitionType: PageTransitionType.scale,
alignment: Alignment.bottomCenter,
),
},
);
}).catchError((err) {
log(err.toString());
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(
FFLocalizations.of(context).getVariableText(
enText: 'Error deleting account',
ptText: 'Erro ao deletar conta',
),
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),
),
),
);
});
notifyListeners();
},
options: FFButtonOptions(
width: MediaQuery.of(context).size.width * 0.3,
height: MediaQuery.of(context).size.height * 0.05,
color: FlutterFlowTheme.of(context).primaryBackground,
textStyle: TextStyle(
color: FlutterFlowTheme.of(context).primaryText,
),
borderSide: BorderSide(
color: FlutterFlowTheme.of(context).primaryBackground,
width: 1,
),
borderRadius: BorderRadius.circular(10),
),
text: FFLocalizations.of(context).getVariableText(
enText: 'Delete',
ptText: 'Deletar',
),
),
borderRadius: BorderRadius.circular(10),
),
text: FFLocalizations.of(context).getVariableText(
enText: 'Delete',
ptText: 'Deletar',
),
],
),
],
);
});
notifyListeners();
// PhpGroup.deleteAccount
// .call(
// devUUID: FFAppState().devUUID,
// userUUID: FFAppState().userUUID,
// )
// .then((value) {
// FFAppState().deleteAll();
// FFAppState().isLogged = false;
// context.goNamed(
// 'welcomePage',
// extra: <String, dynamic>{
// kTransitionInfoKey: const TransitionInfo(
// hasTransition: true,
// transitionType: PageTransitionType.scale,
// alignment: Alignment.bottomCenter,
// ),
// },
// );
// }).catchError((err) {
// log(err.toString());
// ScaffoldMessenger.of(context).showSnackBar(
// SnackBar(
// content: Text(
// FFLocalizations.of(context).getVariableText(
// ptText: 'Erro ao deletar dispositivo',
// enText: 'Error deleting device',
// ),
// 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),
// ),
// ),
// );
// });
}
Future<void> togglePass(BuildContext context) async {