Milad-Akarie / auto_route_library

Flutter route generator
MIT License
1.58k stars 400 forks source link

[Web] Go back and Go forward error with localizationsDelegates #964

Closed chihao10711 closed 2 years ago

chihao10711 commented 2 years ago

In MaterialApp.router, i was add localizationsDelegates like this:

MaterialApp.router(
        theme: ThemeData.dark(),
        locale: const Locale.fromSubtags(languageCode: "en"),
        localizationsDelegates: const <LocalizationsDelegate>[
          AppLocalizations.delegate,
          GlobalMaterialLocalizations.delegate,
          GlobalWidgetsLocalizations.delegate,
          GlobalCupertinoLocalizations.delegate,
        ],
        routerDelegate: _rootRouter.delegate(),
        routeInformationProvider: _rootRouter.routeInfoProvider(),
        routeInformationParser: _rootRouter.defaultRouteParser(),
        builder: (_, router) {
          return router!;
        },
      )

In AdaptiveAutoRouter, I have 2 page: home and login.

@AdaptiveAutoRouter(
  replaceInRouteName: 'Page|Dialog,Route',
  routes: <AutoRoute>[
    AutoRoute(
      path: "/home_page",
      initial: true,
      page: HomePage,
    ),
    AutoRoute(
      path: '/login_page',
      page: LoginPage,
    ),
    RedirectRoute(
      path: '*',
      redirectTo: "/home_page",
    ),
  ],
)

From homePage navigate to loginPage with navigate, and press reload Go back and Go forward was disable.
Howewer, when commend code localizationsDelegates, this worlk fine.

https://user-images.githubusercontent.com/91370163/154199276-73495f6b-d733-4e41-b9cd-d3d4edf2c089.mov

Please help me!

Milad-Akarie commented 2 years ago

@chihao10711 I added localization delegates but I couldn't reproduce the issue. do you still get the same error if you remove just AppLocalization?

chihao10711 commented 2 years ago

Maybe you misunderstood what I meant.

You can see my projects at the link: https://github.com/chihao10711/auto_route_test.git

github-actions[bot] commented 2 years ago

Stale issue message

kirya355 commented 2 years ago

Maybe you misunderstood what I meant.

  • When I add localizationsDelegates ==> error like video.
  • When I remove localizationsDelegates and re-run ===> it works properly.

You can see my projects at the link: https://github.com/chihao10711/auto_route_test.git

Did you manage to solve the problem?