Merge pull request #10 from sBubshait/feature/ux

feat: gesture back improvement
This commit is contained in:
Saleh Bubshait 2025-07-28 10:15:42 +03:00 committed by GitHub
commit d918440743
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
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,7 +379,12 @@ class _SignInPageState extends State<SignInPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
return WillPopScope(
onWillPop: () async {
// Prevent back navigation from sign in page
return false;
},
child: Scaffold(
body: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
@ -616,6 +627,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,
@ -246,6 +251,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(
@ -237,6 +242,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,7 +734,12 @@ class _CreateInvitationPageState extends State<CreateInvitationPage> {
@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(
body: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
@ -1096,6 +1101,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,7 +434,9 @@ class _PostViewPageState extends State<PostViewPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
return PopScope(
canPop: true,
child: Scaffold(
appBar: AppBar(
backgroundColor: Colors.white,
elevation: 0,
@ -456,6 +455,7 @@ class _PostViewPageState extends State<PostViewPage> {
),
backgroundColor: Color(0xFFF5F5F5),
body: _buildBody(),
),
);
}

View File

@ -674,7 +674,12 @@ class _SettingsPageState extends State<SettingsPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
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,
@ -824,6 +829,7 @@ class _SettingsPageState extends State<SettingsPage> {
],
),
),
),
);
}
}