-
-
Notifications
You must be signed in to change notification settings - Fork 124
Description
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 2Describe 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.