Skip to content
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

[Feature Request] Add page stack to the previous location's page stack #683

Open
Colman opened this issue Jan 11, 2025 · 0 comments
Open

Comments

@Colman
Copy link

Colman commented Jan 11, 2025

Is your feature request related to a problem? Please describe.
I have an app with many different BeamLocations in it. Most of these locations and paths can only be accessed from one place in the app which makes things simple. However, there are a few routes that can be reached from many different places. For example, the login screen anytime you tap something that requires authentication, as well as a web view route that serves many different purposes.

My question is, what location should I add the login and web view routes too?

Solution 1 - If I make them have their own location, then once I beam to them, I lose the page states of the previous location I was at. So when I beam back, the route is correct, but the page state is gone.

Solution 2 - If I add the pages to every location, then I have to duplicate a lot of work since I have to consider every possible way that these routes can be reached. For example, I would have to add:

//Location 0
@override
List<Pattern> get pathPatterns {
  return [
    '/path',
    '/path/to',
    '/path/to/login',  //<-- Can reach the login screen from the /path/to route
    '/path/to/page',
    '/path/to/page/web-view', //<-- Can reach the web view screen from the /path/to/page route
  ];
}

//Location 1
@override
List<Pattern> get pathPatterns {
  return [
    '/another',
    '/another/path',
    '/another/path/login', //<-- Can reach the login screen from the /another/path route
    '/another/path/to',
    '/another/path/to/web-view', //<-- Can reach the web view screen from the /another/path/to route
  ];
}

...

//Location 2

Describe the solution you'd like
When calling beamTo or beamToNamed, add a parameter to join page stacks like so:

delegate.beamToNamed(
  //...
  joinPageStacks: true,
  //...
);

If this is set, the page stack of the new location will be stacked on top of the page stack of the current location, instead of disposing the current page stack in favor of the new one.

@Colman Colman changed the title Add page stack to the previous location's page stack [Feature Request] Add page stack to the previous location's page stack Jan 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant