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

@ -10,42 +10,38 @@ class HomeScreen extends StatefulWidget {
class _HomeScreenState extends State<HomeScreen> {
int _currentIndex = 0;
final List<Widget> _pages = [
FeedPage(),
InvitationsPage(),
ProfilePage(),
];
final List<Widget> _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'),
],
),
),
);
}
}
}