feat: Add home route and update logout functionality in user profile bar

This commit is contained in:
Vaibhav Surve 2025-06-11 20:25:01 +05:30
parent 6a36064af7
commit 313350e1a5
2 changed files with 10 additions and 2 deletions

View File

@ -36,6 +36,12 @@ getPageRoute() {
name: '/', name: '/',
page: () => DashboardScreen(), page: () => DashboardScreen(),
middlewares: [AuthMiddleware()]), middlewares: [AuthMiddleware()]),
GetPage(
name: '/home',
page: () => DashboardScreen(), // or your actual home screen
middlewares: [AuthMiddleware()],
),
// Dashboard // Dashboard
GetPage( GetPage(
name: '/dashboard/attendance', name: '/dashboard/attendance',

View File

@ -205,7 +205,9 @@ class _UserProfileBarState extends State<UserProfileBar>
const SizedBox(width: 12), const SizedBox(width: 12),
Expanded( Expanded(
child: ElevatedButton( child: ElevatedButton(
onPressed: () => Navigator.pop(context, true), onPressed: () async {
await LocalStorage.logout();
},
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
backgroundColor: Colors.redAccent, backgroundColor: Colors.redAccent,
foregroundColor: Colors.white, foregroundColor: Colors.white,
@ -250,7 +252,7 @@ class _UserProfileBarState extends State<UserProfileBar>
await LocalStorage.logout(); await LocalStorage.logout();
if (mounted) { if (mounted) {
Navigator.pop(context); Navigator.pop(context);
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
SnackBar( SnackBar(
content: Row( content: Row(