stacked
stacked copied to clipboard
Navigation by browser back and forward button is failing
If I navigate between pages - let's say from page-1 to page-3 then to page-4 and finally to page-2 - I can navigate all the way back by using the browser back-button as expected. The main navigation is done with a menu and the stacked navigation-service issuing the command "navigateWithTransition". As expected the routing information is pushed onto the navigation stack and the back-button of the browser pops the route back to its beginning. The problem is, that if the back-button is then pushed once more even if the backwards navigation has reached its beginning (unfortunately the back-button is then still active), the navigation with the browser buttons is no longer possible neither forwards nor backwards.
@rr-appadaptive I will take a look at this. We're building a Flutter web project for FilledStacks so I'll see if this is reproduced and figure out how to solve it.
@ferrarafer the issue we identified will fix this issue as well.
A fix has been pushed for this when using the new RouterService which is meant for web. It's available in Stacked stacked: ^3.2.6
I'll keep this issue open until I post the docs on how to use the RouterService here.
@FilledStacks WEBONLY using stackedRouter --> How do I prevent the page being POPed when hitting back browser button. Here is my code (2nd page) - I have set the PopScope not to allow pop. However, pressing back button still goes to previous.
@override
Widget builder(
BuildContext context,
HomeViewModel viewModel,
Widget? child,
) {
return PopScope(
canPop: false,
child: Scaffold(
I don't think that's allowed in Flutter, you have to check in a normal Flutter project that it's allowed, then implement it there. Once you get it working in a normal Flutter project without Stacked then you can implement it the same way for Stacked.