From 5eb191e93e5fa61400f256594609c6067e0d960e Mon Sep 17 00:00:00 2001 From: sBubshait Date: Thu, 24 Jul 2025 14:19:15 +0300 Subject: [PATCH] feat: fix gesture back to prevent going bakc to login --- frontend/lib/screens/home_screen.dart | 62 +++++++++++++-------------- 1 file changed, 29 insertions(+), 33 deletions(-) diff --git a/frontend/lib/screens/home_screen.dart b/frontend/lib/screens/home_screen.dart index 3e7d29d..e34a34b 100644 --- a/frontend/lib/screens/home_screen.dart +++ b/frontend/lib/screens/home_screen.dart @@ -10,42 +10,38 @@ class HomeScreen extends StatefulWidget { class _HomeScreenState extends State { int _currentIndex = 0; - - final List _pages = [ - FeedPage(), - InvitationsPage(), - ProfilePage(), - ]; + + final List _pages = [FeedPage(), InvitationsPage(), ProfilePage()]; @override Widget build(BuildContext context) { - return Scaffold( - body: _pages[_currentIndex], - bottomNavigationBar: BottomNavigationBar( - currentIndex: _currentIndex, - onTap: (index) { - setState(() { - _currentIndex = index; - }); - }, - type: BottomNavigationBarType.fixed, - selectedItemColor: Color(0xFF6A4C93), - unselectedItemColor: Colors.grey, - items: [ - BottomNavigationBarItem( - icon: Icon(Icons.home), - label: 'Feed', - ), - BottomNavigationBarItem( - icon: Icon(Icons.mail), - label: 'Invitations', - ), - BottomNavigationBarItem( - icon: Icon(Icons.person), - label: 'Profile', - ), - ], + return WillPopScope( + onWillPop: () async { + // Prevent going back to authentication screens + return false; + }, + child: Scaffold( + body: _pages[_currentIndex], + bottomNavigationBar: BottomNavigationBar( + currentIndex: _currentIndex, + onTap: (index) { + setState(() { + _currentIndex = index; + }); + }, + type: BottomNavigationBarType.fixed, + selectedItemColor: Color(0xFF6A4C93), + unselectedItemColor: Colors.grey, + items: [ + BottomNavigationBarItem(icon: Icon(Icons.home), label: 'Feed'), + BottomNavigationBarItem( + icon: Icon(Icons.mail), + label: 'Invitations', + ), + BottomNavigationBarItem(icon: Icon(Icons.person), label: 'Profile'), + ], + ), ), ); } -} \ No newline at end of file +}