diff --git a/frontend/lib/screens/pages/profile_page.dart b/frontend/lib/screens/pages/profile_page.dart index 6cd5dbc..b08beaf 100644 --- a/frontend/lib/screens/pages/profile_page.dart +++ b/frontend/lib/screens/pages/profile_page.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import '../../services/notification_service.dart'; import '../../services/user_service.dart'; +import '../../services/auth_service.dart'; class ProfilePage extends StatefulWidget { @override @@ -449,7 +450,7 @@ class _SettingsPageState extends State { } } - void _signOut() { + void _signOut() async { showDialog( context: context, builder: (BuildContext context) { @@ -462,10 +463,14 @@ class _SettingsPageState extends State { child: Text('Cancel'), ), TextButton( - onPressed: () { + onPressed: () async { Navigator.of(context).pop(); - ScaffoldMessenger.of(context).showSnackBar( - SnackBar(content: Text('Signed out successfully')), + + await AuthService.logout(); + + Navigator.of(context).pushNamedAndRemoveUntil( + '/', + (route) => false, ); }, child: Text('Sign Out', style: TextStyle(color: Colors.red)),