My app is using CupertinoTabScaffold and CupertinoTabView which is using its own navigator (not the root navigator). To open a certain screen which should cover the entire screen (also the tabs) I'm using Navigator.of(context, rootNavigator: true).push. The problem is that for a different purpose I'm tracking screen changes using routeObserver and RouteAware. What I found out is that with respect to the case mentioned above of opening a screen using the root navigator, the didPopNext isn't called when closing the full screen page. I'm assuming it's somehow related to the fact that by closing this screen Flutter is switching from the root navigator back to the CupertinoTabView. Any idea how to solve it?
u should add this:
@override
void didChangeDependencies() {
super.didChangeDependencies();
// add this
routeObserver.subscribe(this, ModalRoute.of(context));
}
@override
void dispose() {
routeObserver.unsubscribe(this);
super.dispose();
}
final RouteObserver<PageRoute> routeObserver = RouteObserver<PageRoute>();
...
MaterialApp(
navigatorObservers: [routeObserver],
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With