feat: gesture back improvement

This commit is contained in:
sBubshait 2025-07-28 10:15:16 +03:00
parent e73bc88879
commit a2abe08d3a
8 changed files with 75 additions and 36 deletions

View File

@ -129,7 +129,12 @@ class _LandingPageState extends State<LandingPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
return WillPopScope(
onWillPop: () async {
// Prevent back navigation from landing page
return false;
},
child: Scaffold(
body: Stack(
children: [
// Background gradient
@ -234,6 +239,7 @@ class _LandingPageState extends State<LandingPage> {
),
],
),
),
);
}
}
@ -373,8 +379,13 @@ class _SignInPageState extends State<SignInPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Container(
return WillPopScope(
onWillPop: () async {
// Prevent back navigation from sign in page
return false;
},
child: Scaffold(
body: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
@ -615,6 +626,7 @@ class _SignInPageState extends State<SignInPage> {
],
),
),
),
),
);
}

View File

@ -70,7 +70,12 @@ class _CreatePostScreenState extends State<CreatePostScreen> {
final remainingChars = _maxCharacters - _bodyController.text.length;
final isOverLimit = remainingChars < 0;
return Scaffold(
return WillPopScope(
onWillPop: () async {
// Allow back navigation to go back to feed page only
return true;
},
child: Scaffold(
appBar: AppBar(
title: Text('Create Post', style: TextStyle(fontWeight: FontWeight.w600)),
backgroundColor: Colors.white,
@ -245,6 +250,7 @@ class _CreatePostScreenState extends State<CreatePostScreen> {
],
),
),
),
),
);
}

View File

@ -15,11 +15,8 @@ class _HomeScreenState extends State<HomeScreen> {
@override
Widget build(BuildContext context) {
return WillPopScope(
onWillPop: () async {
// Prevent going back to authentication screens
return false;
},
return PopScope(
canPop: false, // Prevent going back to authentication screens
child: Scaffold(
body: _pages[_currentIndex],
bottomNavigationBar: BottomNavigationBar(

View File

@ -79,7 +79,12 @@ class _NotificationPermissionScreenState
@override
Widget build(BuildContext context) {
return Scaffold(
return WillPopScope(
onWillPop: () async {
// Prevent back navigation from notification permission screen
return false;
},
child: Scaffold(
body: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
@ -236,6 +241,7 @@ class _NotificationPermissionScreenState
),
),
),
),
),
);
}

View File

@ -152,7 +152,12 @@ class _InvitationDetailsPageState extends State<InvitationDetailsPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
return WillPopScope(
onWillPop: () async {
// Allow back navigation to go back to invitations page only
return true;
},
child: Scaffold(
backgroundColor: Colors.grey[50],
appBar: AppBar(
title: Text(
@ -545,6 +550,7 @@ class _InvitationDetailsPageState extends State<InvitationDetailsPage> {
],
),
),
),
);
}
}

View File

@ -734,8 +734,13 @@ class _CreateInvitationPageState extends State<CreateInvitationPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Container(
return WillPopScope(
onWillPop: () async {
// Allow back navigation to go back to invitations page only
return true;
},
child: Scaffold(
body: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
@ -1095,6 +1100,7 @@ class _CreateInvitationPageState extends State<CreateInvitationPage> {
],
),
),
),
),
);
}

View File

@ -149,10 +149,7 @@ class _PostViewPageState extends State<PostViewPage> {
final avatarLetter = _getAvatarLetter(user.displayName);
return Transform.translate(
offset: Offset(
index < displayUsers.length - 1 ? -8 : 0,
0,
),
offset: Offset(index < displayUsers.length - 1 ? -8 : 0, 0),
child: CircleAvatar(
radius: 16,
backgroundColor: Colors.white,
@ -437,25 +434,28 @@ class _PostViewPageState extends State<PostViewPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.white,
elevation: 0,
leading: IconButton(
onPressed: () => Navigator.pop(context),
icon: Icon(Icons.arrow_back, color: Colors.black87),
),
title: Text(
'Post',
style: TextStyle(
color: Colors.black87,
fontSize: 18,
fontWeight: FontWeight.w600,
return PopScope(
canPop: true,
child: Scaffold(
appBar: AppBar(
backgroundColor: Colors.white,
elevation: 0,
leading: IconButton(
onPressed: () => Navigator.pop(context),
icon: Icon(Icons.arrow_back, color: Colors.black87),
),
title: Text(
'Post',
style: TextStyle(
color: Colors.black87,
fontSize: 18,
fontWeight: FontWeight.w600,
),
),
),
backgroundColor: Color(0xFFF5F5F5),
body: _buildBody(),
),
backgroundColor: Color(0xFFF5F5F5),
body: _buildBody(),
);
}

View File

@ -674,9 +674,14 @@ class _SettingsPageState extends State<SettingsPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Settings', style: TextStyle(fontWeight: FontWeight.w600)),
return WillPopScope(
onWillPop: () async {
// Allow back navigation to go back to profile page only
return true;
},
child: Scaffold(
appBar: AppBar(
title: Text('Settings', style: TextStyle(fontWeight: FontWeight.w600)),
backgroundColor: Colors.white,
foregroundColor: Color(0xFF6A4C93),
elevation: 0,
@ -823,6 +828,7 @@ class _SettingsPageState extends State<SettingsPage> {
),
],
),
),
),
);
}