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

Defining beamBackOnPop in BeamLocation constructor does not work #628

Open
haqqi opened this issue Jul 18, 2023 · 1 comment
Open

Defining beamBackOnPop in BeamLocation constructor does not work #628

haqqi opened this issue Jul 18, 2023 · 1 comment

Comments

@haqqi
Copy link

haqqi commented Jul 18, 2023

Beamer version: 1.5.6

Describe the bug

Developing for Android app. The original behavior of Beamer (i suppose) it is like:

  1. Render to /auth/login.
  2. From login page, I want to beam to /auth/register (register page).
  3. From register page, when I push back button (andorid) or app bar's back button, the route will be popped /auth, which is not found in my setup. The behavior i want is beam back.
  4. Setting up alwaysBeamBack in BeamerBackButtonDispatcher will solve the behavior of android back button. But not app bar back button.

Well, it can be solved by putting parameter beamBackOnPop to true whenever I call the navigation method. Such as:

Beamer.of(context).beamToNamed(
  '/auth/register`,
  beamBackOnPop: true,
);

This is kinda frustating to set it on every navigation.

Then, I noticed there is a parameter for BeamLocation, which is BeamParameters that has beamBackOnPop. Nice.

But, when I set the parameters, it won't work. It is still running on original behavior, which is removing the last URI.

AuthLocation()
    : super(
        null,
        const BeamParameters(
          beamBackOnPop: true,
        ),
      ); 

Expected behavior

Because the "key concepts" of Beamer, I think this parameter exists to solve the responsibility separation. So, if i am not wrong, the correct behavior should be:

If I set the beamBackOnPop parameters to true in BeamLocation child classes, whenever the route goes to that location, the beamback will be chosen as default pop mechanism.

Smartphone:
Xiami Mi 8 with latest PixelExperience ROM

Additional context
For now, as I need to finish the project quickly, I go with workaround by setting up beamBackOnPop parameter each time when I called beamToNamed function.

Also, if possible, may be there should be a BeamParameter that can be set up in global for BeamerDelegate.

@SAGARSURI
Copy link

@slovnicki any update on this?

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

2 participants