stacked icon indicating copy to clipboard operation
stacked copied to clipboard

Navigation by browser back and forward button is failing

Open rr-appadaptive opened this issue 2 years ago • 5 comments

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 avatar Feb 02 '23 22:02 rr-appadaptive

@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.

FilledStacks avatar Feb 08 '23 13:02 FilledStacks

@ferrarafer the issue we identified will fix this issue as well.

FilledStacks avatar May 16 '23 09:05 FilledStacks

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 avatar May 16 '23 14:05 FilledStacks

@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(

Abhijit-Revamp avatar Feb 10 '24 00:02 Abhijit-Revamp

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.

FilledStacks avatar Feb 13 '24 07:02 FilledStacks