FIX: internet connection exception in settings
This commit is contained in:
parent
87e092a070
commit
cf79bff8e4
|
@ -273,15 +273,47 @@ class PreferencesPageModel with ChangeNotifier {
|
||||||
),
|
),
|
||||||
FFButtonWidget(
|
FFButtonWidget(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
PhpGroup.resopndeVinculo
|
try {
|
||||||
.call(
|
await PhpGroup.resopndeVinculo
|
||||||
userUUID: FFAppState().userUUID,
|
.call(
|
||||||
devUUID: FFAppState().devUUID,
|
userUUID: FFAppState().userUUID,
|
||||||
cliID: FFAppState().cliUUID,
|
devUUID: FFAppState().devUUID,
|
||||||
tarefa: 'I',
|
cliID: FFAppState().cliUUID,
|
||||||
)
|
tarefa: 'I',
|
||||||
// ignore: body_might_complete_normally_catch_error
|
)
|
||||||
.catchError((err, stack) {
|
// 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();
|
||||||
|
} catch (err, stack) {
|
||||||
log(err.toString());
|
log(err.toString());
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
SnackBar(
|
SnackBar(
|
||||||
|
@ -300,16 +332,7 @@ class PreferencesPageModel with ChangeNotifier {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}).then(
|
}
|
||||||
(value) {
|
|
||||||
FFAppState().deleteCliUUID();
|
|
||||||
FFAppState().deleteLocal();
|
|
||||||
FFAppState().deleteOwnerUUID();
|
|
||||||
Navigator.pop(context);
|
|
||||||
Navigator.pop(context);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
notifyListeners();
|
|
||||||
},
|
},
|
||||||
text: FFLocalizations.of(context).getVariableText(
|
text: FFLocalizations.of(context).getVariableText(
|
||||||
enText: 'Unlink',
|
enText: 'Unlink',
|
||||||
|
@ -381,26 +404,50 @@ class PreferencesPageModel with ChangeNotifier {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
FFButtonWidget(
|
FFButtonWidget(
|
||||||
onPressed: () {
|
onPressed: () async {
|
||||||
PhpGroup.deleteAccount
|
try {
|
||||||
.call(
|
await PhpGroup.deleteAccount
|
||||||
devUUID: FFAppState().devUUID,
|
.call(
|
||||||
userUUID: FFAppState().userUUID,
|
devUUID: FFAppState().devUUID,
|
||||||
)
|
userUUID: FFAppState().userUUID,
|
||||||
.then((value) {
|
)
|
||||||
FFAppState().deleteAll();
|
.then((value) {
|
||||||
FFAppState().isLogged = false;
|
FFAppState().deleteAll();
|
||||||
context.goNamed(
|
FFAppState().isLogged = false;
|
||||||
'welcomePage',
|
context.goNamed(
|
||||||
extra: <String, dynamic>{
|
'welcomePage',
|
||||||
kTransitionInfoKey: const TransitionInfo(
|
extra: <String, dynamic>{
|
||||||
hasTransition: true,
|
kTransitionInfoKey: const TransitionInfo(
|
||||||
transitionType: PageTransitionType.scale,
|
hasTransition: true,
|
||||||
alignment: Alignment.bottomCenter,
|
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),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
},
|
);
|
||||||
);
|
});
|
||||||
}).catchError((err) {
|
notifyListeners();
|
||||||
|
} catch (err, stack) {
|
||||||
log(err.toString());
|
log(err.toString());
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
SnackBar(
|
SnackBar(
|
||||||
|
@ -419,8 +466,7 @@ class PreferencesPageModel with ChangeNotifier {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
notifyListeners();
|
|
||||||
},
|
},
|
||||||
options: FFButtonOptions(
|
options: FFButtonOptions(
|
||||||
width: MediaQuery.of(context).size.width * 0.3,
|
width: MediaQuery.of(context).size.width * 0.3,
|
||||||
|
|
Loading…
Reference in New Issue