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

Is path restoration when switching tabs intentional when setting IndexedPage.of(context).index? #325

Open
maikeriva opened this issue Jun 9, 2023 · 0 comments

Comments

@maikeriva
Copy link

maikeriva commented Jun 9, 2023

Hi!

I have a a tabbed routing setup with IndexedPage as follows:

'/': (route) => const IndexedPage(
    child: Home(),
    paths: [
      '/tab0',
      '/tab1',
    ],
  ),
'/tab0': (route) => const MaterialPage(child: TabZero()),
'/tab1': (route) => const MaterialPage(child: TabOne()),
'/tab1/subtab': (route) => const MaterialPage(child: SubTab()),

If I navigate with the following flow, the bold effect happens:

  1. App starts on /tab0
  2. IndexedPage.of(context).index = 1 (app goes to /tab1)
  3. router.push('/tab1/subtab/') (app goes to /tab1/subtab)
  4. IndexedPage.of(context).index = 0 (app goes to /tab0)
  5. IndexedPage.of(context).index = 1 (app goes to /tab1/subtab, and also performs transition from /tab1 to /tab1/subtab)

What I would like to happen is the app to go back to /tab1, not /tab1/subtab. So far, I solved this by replacing IndexedPage calls with router.push ones, but then I wonder why we can navigate by setting the IndexedPage index in the first place?...

Or maybe this is intentional behaviour. If it is, I personally would expect as a user the transition animation to NOT be the one from /tab1 to /tab1/subtab, but rather the one for tab switching. I would feel like I'm going back to a view I temporarily "cast aside". With the current behaviour it is weird to see the path rebuilding itself through transitions from /tab1 to /tab1/subtab everytime I change tab.

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