-
Notifications
You must be signed in to change notification settings - Fork 26.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No close button when using Navigator in full-screen dialog route #33038
Comments
Haven't had a chance to look at this carefully however it looks like Scaffold whose app bar isn't showing a back button because there's no route to pop. In this case you don't want the Scaffold's Navigator to pop its route, but the enclosing Navigator to do so. Maybe add a BackButton to the AppBar that DTRT. |
@HansMuller You're right. I didn't think of the fact, that the I changed the void _pushModalNavigator(BuildContext context) {
Navigator.of(context).push(
MaterialPageRoute(
fullscreenDialog: true,
builder: (context) => Navigator(
onGenerateRoute: (routeSettings) {
return MaterialPageRoute(
fullscreenDialog: true,
builder: (context) {
return Scaffold(
appBar: AppBar(
leading: InkWell(
child: Icon(Icons.close),
onTap: () {
Navigator.of(context).pop();
},
),
),
body: InkWell(
child: Text('Modal navigator'),
onTap: () {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => Scaffold(
appBar: AppBar(),
body: Text('Modal navigator page 2'),
),
),
);
},
),
);
},
);
},
),
),
);
} Not sure what is going in here, as the same |
Your
Is getting the Navigator starting on this line:
One way to fix this is to change line 9 to:
|
Hi @tp |
Without additional information we are unfortunately not sure how to resolve this issue. |
Use the root navigator to push a |
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 |
Steps to Reproduce
I want to use a navigator in a modal route, but when I do it like in the minimal example code below, there is no close button shown on the app bar:
The text was updated successfully, but these errors were encountered: