Repository navigation
[go_router] ShellRoutes break iOS swipe back navigation #120353
Description
go_router version: 6.0.4
flutter version: 3.3.9
Hi go_router team,
we experience an unexpected behaviour when it comes to using GoRouter with ShellRoutes in combination with the iOS "swipe to go back" gesture. The navigation seems to skip over all routes wrapped in the ShellRoute. Everything works as expected with the Android "swipe to go back" gesture.
Steps to Reproduce
With the below code sample using a ShellRoute, navigate to sub-page "AcknowledgementsPage" and then "swipe to go back" on iOS.
Expected results: Navigation goes back only one page to "AboutThisAppPage".
Actual results: Navigation skips any page wrapped in ShellRoute, goes back to "HomePage".
Code sample
With this example, the "swipe to go back" works as expected:GoRouter(
initialLocation: '/home',
routes: [
GoRoute(
path: '/home',
name: HomePage.routeName,
pageBuilder: const HomePage(),
routes: [
GoRoute(
path: 'about',
name: AboutThisAppPage.routeName,
pageBuilder: const AboutThisAppPage(),
routes: [
GoRoute(
path: 'acknowledgements',
name: AcknowledgementsPage.routeName,
pageBuilder: const AcknowledgementsPage(),
),
]),
])
]);When including a ShellRoute, swipe to go back from "AcknowledgementsPage" will go back to "HomePage" instead of "AboutThisAppPage".
GoRouter(
initialLocation: '/home',
routes: [
GoRoute(
path: '/home',
name: HomePage.routeName,
pageBuilder: const HomePage(),
routes: [
// This minimal ShellRoute does not provide any benefit but is enough to reproduce the unexpected behaviour
ShellRoute(
builder: (context, state, child) {
return child;
},
routes: [
GoRoute(
path: 'about',
name: AboutThisAppPage.routeName,
pageBuilder: const AboutThisAppPage(),
routes: [
GoRoute(
path: 'acknowledgements',
name: AcknowledgementsPage.routeName,
pageBuilder: const AcknowledgementsPage(),
),
]),
]
)
])
]);Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsNo status
Activity
exaby73 commentedon Feb 9, 2023
Hello @mnefzger. Thank you for filing this issue. Can you please provide the following information?
main.dartfile that can be run directly.flutter doctor -vPlease provide the information in the form of text. See how to make collapsible sections with Markdown here.
mnefzger commentedon Feb 9, 2023
Hi @exaby73,
sure – sorry for not adding a full example from the start.
Expected: Swipe to go back on "ThirdPage" leads to "Second Page"
Actual: Leads back to "HomePage"
main.dart
flutter doctor -v
exaby73 commentedon Feb 10, 2023
Triage report
I can reproduce this issue with
Master (3.8.0-9.0.pre.20)Code Sample (Same as OP)
flutter doctor -v(Master)31 remaining items
deandreamatias commentedon Jul 3, 2025
Maybe this package help someone swipeable_page_route
iamtechieboy commentedon Jul 24, 2025
Still experiencing this issue. Is there anyone fixed this issue ?
iamtechieboy commentedon Jul 24, 2025
Why is there any solution for more than 2 years. I really disappointed. I like using go_router but what they didn't give attention on this issue yet.
mustafamasri1 commentedon Jul 24, 2025
Just wrap you ShellRoute builder with :
This support nested ShellRoutes also by looping and checking last ShellRoute
iamtechieboy commentedon Jul 24, 2025
@mustafamasri1 Thanks bro. It works finally.
[go_router] Fix ShellRoutes break iOS swipe back navigation (#9968)
github-actions commentedon Oct 7, 2025
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.[go_router] Fix ShellRoutes break iOS swipe back navigation (flutter#…