hightman / getx5-example_nav2

A new Flutter project use Nav2.0 with nested routing.
4 stars 0 forks source link

When the application has two levels of IndexedRouteBuilder, it does not work properly #5

Closed liseipi closed 2 months ago

liseipi commented 2 months ago

When the application has two levels of IndexedRouteBuilder, it does not work properly

my route

static final routes = [
    GetPage(
      preventDuplicates: true,
      participatesInRootNavigator: true, 
      name: '/index',
      page: () => const IndexPage(),
      // bindings: [
      //   HomeBinding(),
      // ],
      title: null,
      children: [
        GetPage(
          name: '/home',
          page: () => const HomePage(),
          // bindings: [
          //   DashboardBinding(),
          // ],
          transition: Transition.cupertino,
          // showCupertinoParallax: true,
          // preventDuplicates: true,
          // participatesInRootNavigator: false,
          children:[
            GetPage(
              name: '/af',
              transition: Transition.cupertino,
              showCupertinoParallax: true,
              // preventDuplicates: true,
              participatesInRootNavigator: false,
              page: () => const AfPage(),
              // bindings: const [],
              // middlewares: [
              //   //only enter this route when authed
              //   EnsureAuthMiddleware(),
              // ],
            ),
            GetPage(
              name: '/as',
              transition: Transition.cupertino,
              showCupertinoParallax: true,
              // preventDuplicates: true,
              participatesInRootNavigator: false, 
              page: () => const AsPage(),
              // bindings: const [],
              // middlewares: [
              //   //only enter this route when authed
              //   EnsureAuthMiddleware(),
              // ],
            ),
          ],
        ),
        GetPage(
          // middlewares: [
          //   //only enter this route when authed
          //   EnsureAuthMiddleware(),
          // ],
          name: '/profile',
          page: () => const ProfilePage(),
          title: 'Profile',
          transition: Transition.size,
          showCupertinoParallax: true,
          participatesInRootNavigator: false,
          // bindings: [ProfileBinding()],
        ),
  ]

There are IndexedRouteBuilder in both '/index' and '/index/home' pages, so the one in /index/home does not work