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

How to correctly restore navigation stack with temporary router? #150

Open
BarashkovaElena opened this issue Aug 9, 2024 · 1 comment
Open
Labels
enhancement New feature or request

Comments

@BarashkovaElena
Copy link

I have an issue with state restoration and temporarty router.
Here are my routes:

class AppRoutes {
  static List<QRoute> bottomSheetRoutes = [
    QRoute(
        name: bottomSheetExamplePageName,
        path: bottomSheetExamplePagePath,
        builder: () => const BottomSheetExamplePage(),
    ),
  ];
  final routes = [
    QRoute(
        name: homePageName,
        path: homePagePath,
        pageType: const QPlatformPage(restorationId: homePageName),
        builder: () => const HomePage(),
        children: [
          ...bottomSheetRoutes,
        ],
  ];
}

I want to show bottom sheet over the home page with temporary router and call this method on HomePage:

    showModalBottomSheet(
      context: context,
      builder: (_) => TemporaryQRouter(
        path: '/temp_router',
        initPath: bottomSheetExamplePagePath,
        routes: AppRoutes.bottomSheetRoutes,
      ),
    );

The steps are the following:

  1. Enable "Don't keep activities" option on Android device.
  2. Open the app, from home page call showModalBottomSheet method.
  3. Put the app to background, so that the system kills its process.
  4. Return to the app, so that its state and route are restored.
    Expected result: the app is opened on the home page, the current path is '/home'
    Actual result: the app shows "Page not found', the current path is '/temp_router/bottom_sheet_example'

Is there a way to have the expected result?

@SchabanBo
Copy link
Owner

Temporary router does not support state restoration yet

@SchabanBo SchabanBo added the enhancement New feature or request label Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants