This commit is contained in:
jantunesmesias 2024-08-22 15:22:55 -03:00
parent 0aa9648616
commit ebdcf93deb
3 changed files with 47 additions and 2 deletions

View File

@ -113,6 +113,30 @@ class MenuComponentModel extends FlutterFlowModel<MenuComponentWidget> {
); );
} }
Future<void> signOut(BuildContext context) async {
showAlertDialog(
context,
'Logout',
FFLocalizations.of(context).getVariableText(
enText: 'Are you sure you want to logout?',
ptText: 'Tem certeza',
), () async {
AppState().deleteAll();
// setState(() {});
context.goNamed(
'welcomePage',
extra: <String, dynamic>{
kTransitionInfoKey: const TransitionInfo(
hasTransition: true,
transitionType: PageTransitionType.scale,
alignment: Alignment.bottomCenter,
),
},
);
});
}
Future preferencesSettings(BuildContext context) async { Future preferencesSettings(BuildContext context) async {
context.pushNamed( context.pushNamed(
'preferencesSettings', 'preferencesSettings',

View File

@ -251,6 +251,17 @@ class _MenuComponentWidgetState extends State<MenuComponentWidget> {
ptText: 'Consultar Historicos', ptText: 'Consultar Historicos',
), ),
), ),
MenuCardItem(
icon: Icons.logout,
action: () async {
await _model.signOut(context);
setState(() {});
},
title: FFLocalizations.of(context).getVariableText(
enText: 'Logout Account',
ptText: 'Sair da Conta',
),
),
MenuCardItem( MenuCardItem(
icon: Icons.settings, icon: Icons.settings,
action: () async { action: () async {

View File

@ -313,8 +313,18 @@ class PreferencesPageModel with ChangeNotifier {
AppState().deleteCliUUID(); AppState().deleteCliUUID();
AppState().deleteLocal(); AppState().deleteLocal();
AppState().deleteOwnerUUID(); AppState().deleteOwnerUUID();
Navigator.pop(context); // Navigator.pop(context);
Navigator.pop(context, true); // Navigator.pop(context, true);
context.goNamed(
'homePage',
extra: <String, dynamic>{
kTransitionInfoKey: const TransitionInfo(
hasTransition: true,
transitionType: PageTransitionType.scale,
alignment: Alignment.bottomCenter,
),
},
);
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
SnackBar( SnackBar(