Reputation: 1671
I've got;
screen/widget Home()
which calls;
screen/widget MainStage()
which calls;
future method futureStage()
which builds;
PageViewBuilder StageBuilder()
which contains;
SwipeGestureRecognizer
which calls;
Navigator.push (context,
PageTransition(
type: PageTransitionType.downToUp,
child: HomeReply(),
));
HomeReply()
contains;appBar
with an arrow/button that allows the user to;Navigator.pop(context)
;How do I get the Navigator to pop back to Home()
?
Upvotes: 0
Views: 4979
Reputation: 1671
Turns out HomeReply() had an extra MaterialApp in the build. Once I removed this it all worked as normal with Navigator.pop(context);
.
Upvotes: 1
Reputation: 842
The navigator is a stack so you can use the popUntil
method to pop back to your home() screen.
Navigator.popUntil(context, ModalRoute.withName('/home'));
or
Navigator.of(context).popUntil((route) => route.settings.name == "Home");
Upvotes: 1