Milad-Akarie / auto_route_library

Flutter route generator
MIT License
1.56k stars 394 forks source link

[Web] Redirection cannot be made with the web back button. #1891

Open aysenurperker1 opened 5 months ago

aysenurperker1 commented 5 months ago

I am routing with auto route, but when I press the back button on the web, although the path in the url changes, it does not go to that screen and remains on the same screen.

https://github.com/Milad-Akarie/auto_route_library/assets/74301727/c8ced64c-0176-4ae7-8889-dba2b8f48a3c

Auto router dart file code:

@AutoRouterConfig(replaceInRouteName: 'View')
class AppRouter extends _$AppRouter {

  @override
  final List<AutoRoute> routes = [
    AutoRoute(
      path: '/',
      page: HomeViewRoute.page,
    ),
    AutoRoute(
      path: '/signin',
      page: SignInViewRoute.page,
    ),
    AutoRoute(path: '/platform', page: BaseRouterPageRoute.page, children: [
      AutoRoute(path: '', page: BaseRouterViewRoute.page, children: [
        AutoRoute(
          path: 'dashboard',
          page: DashboardViewRoute.page,
          maintainState: false,
        ),
        AutoRoute(
            page: SecondsPageRoute.page,
            path: 'seconds-page',
            children: [
              AutoRoute(
                page: ;SecondsViewRoute.page,
                path: '',
                maintainState: false,
              ),
              AutoRoute(
                path: 'seconds-detail',
                page: SecondsDetailViewRoute.page,
                maintainState: false,
              ),
            ]),
      ]),
    ]),
  ];
}

Is there anything else I need to do for the web other than routing?

Milad-Akarie commented 5 months ago

@aysenurperker1 what versions are you on?

aysenurperker1 commented 5 months ago

auto_route_generator: 7.3.2 auto_route: 7.8.4

aysenurperker1 commented 5 months ago

Hi, I will share my main dev codes with you. When I used the builder parameter here, I realized that the back button did not work, but since I am using One context, I need to use builder.

MaterialApp.router{ builder: (context,child) => OneContext().builder(context, child), routerConfig: _appRouter.config() } @Milad-Akarie