jonataslaw / getx

Open screens/snackbars/dialogs/bottomSheets without context, manage states and inject dependencies easily with Get.
MIT License
10.39k stars 1.63k forks source link

When the application has two levels of IndexedRouteBuilder, it does not work properly , The problem I'm having with nested routes. #3187

Closed liseipi closed 2 months ago

liseipi commented 2 months ago

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

https://github.com/hightman/getx5-example_nav2

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