diff --git a/lib/components/organism_components/menu_component/menu_component_model.dart b/lib/components/organism_components/menu_component/menu_component_model.dart index 07f56b9c..1dd63013 100644 --- a/lib/components/organism_components/menu_component/menu_component_model.dart +++ b/lib/components/organism_components/menu_component/menu_component_model.dart @@ -113,6 +113,30 @@ class MenuComponentModel extends FlutterFlowModel { ); } + Future 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: { + kTransitionInfoKey: const TransitionInfo( + hasTransition: true, + transitionType: PageTransitionType.scale, + alignment: Alignment.bottomCenter, + ), + }, + ); + }); + } + Future preferencesSettings(BuildContext context) async { context.pushNamed( 'preferencesSettings', diff --git a/lib/components/organism_components/menu_component/menu_component_widget.dart b/lib/components/organism_components/menu_component/menu_component_widget.dart index 7f47739e..c3870251 100644 --- a/lib/components/organism_components/menu_component/menu_component_widget.dart +++ b/lib/components/organism_components/menu_component/menu_component_widget.dart @@ -251,6 +251,17 @@ class _MenuComponentWidgetState extends State { 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( icon: Icons.settings, action: () async { diff --git a/lib/pages/preferences_settings_page/preferences_settings_model.dart b/lib/pages/preferences_settings_page/preferences_settings_model.dart index 53637a29..07912126 100644 --- a/lib/pages/preferences_settings_page/preferences_settings_model.dart +++ b/lib/pages/preferences_settings_page/preferences_settings_model.dart @@ -313,8 +313,18 @@ class PreferencesPageModel with ChangeNotifier { AppState().deleteCliUUID(); AppState().deleteLocal(); AppState().deleteOwnerUUID(); - Navigator.pop(context); - Navigator.pop(context, true); + // Navigator.pop(context); + // Navigator.pop(context, true); + context.goNamed( + 'homePage', + extra: { + kTransitionInfoKey: const TransitionInfo( + hasTransition: true, + transitionType: PageTransitionType.scale, + alignment: Alignment.bottomCenter, + ), + }, + ); ScaffoldMessenger.of(context).showSnackBar( SnackBar(