feat: fix gesture back to prevent going bakc to login

This commit is contained in:
sBubshait 2025-07-24 14:19:15 +03:00
parent 526cf94360
commit 5eb191e93e

View File

@ -11,15 +11,16 @@ class HomeScreen extends StatefulWidget {
class _HomeScreenState extends State<HomeScreen> { class _HomeScreenState extends State<HomeScreen> {
int _currentIndex = 0; int _currentIndex = 0;
final List<Widget> _pages = [ final List<Widget> _pages = [FeedPage(), InvitationsPage(), ProfilePage()];
FeedPage(),
InvitationsPage(),
ProfilePage(),
];
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return WillPopScope(
onWillPop: () async {
// Prevent going back to authentication screens
return false;
},
child: Scaffold(
body: _pages[_currentIndex], body: _pages[_currentIndex],
bottomNavigationBar: BottomNavigationBar( bottomNavigationBar: BottomNavigationBar(
currentIndex: _currentIndex, currentIndex: _currentIndex,
@ -32,20 +33,15 @@ class _HomeScreenState extends State<HomeScreen> {
selectedItemColor: Color(0xFF6A4C93), selectedItemColor: Color(0xFF6A4C93),
unselectedItemColor: Colors.grey, unselectedItemColor: Colors.grey,
items: [ items: [
BottomNavigationBarItem( BottomNavigationBarItem(icon: Icon(Icons.home), label: 'Feed'),
icon: Icon(Icons.home),
label: 'Feed',
),
BottomNavigationBarItem( BottomNavigationBarItem(
icon: Icon(Icons.mail), icon: Icon(Icons.mail),
label: 'Invitations', label: 'Invitations',
), ),
BottomNavigationBarItem( BottomNavigationBarItem(icon: Icon(Icons.person), label: 'Profile'),
icon: Icon(Icons.person),
label: 'Profile',
),
], ],
), ),
),
); );
} }
} }