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

VNester inside stacked routes #215

Open
alhamed1 opened this issue May 3, 2023 · 1 comment
Open

VNester inside stacked routes #215

alhamed1 opened this issue May 3, 2023 · 1 comment

Comments

@alhamed1
Copy link

alhamed1 commented May 3, 2023

I work on an app with a main menu with nested navigation, and in the drawer, I have some routes which I want to be stacked, each one might have nested routes also, but given the routes blew I can't navigate to the accountStatement route.

final guardedRoutes = [
  VNester(
    path: "/",
    widgetBuilder: (child) {
      return RootLayout(
        child: child,
      );
    },
    nestedRoutes: mainRoutes.children
        .map(
          (e) => VWidget(
            buildTransition: (animation, secondaryAnimation, child) =>
                FadeTransition(
              opacity: animation,
              child: child,
            ),
            path: e.value!.route,
            widget: e.value!.child,
          ),
        )
        .toList(),
    stackedRoutes: mainChildren,
  ),
];

final mainChildren = [
  VNester(
    path: AccountStatementPage.route,
    aliases: [
      AccountStatementPage.route,
      AccountStatementPage.route.substring(1),
    ],
    widgetBuilder: (child) {
      return AccountStatementPage(
        child: child,
      );
    },
    nestedRoutes: mainRoutes.children
        .map(
          (e) => VWidget(
            buildTransition: (animation, secondaryAnimation, child) =>
                FadeTransition(
              opacity: animation,
              child: child,
            ),
            path: e.value!.route,
            widget: e.value!.child,
          ),
        )
        .toList(),
  ),
];

examples:
/ => overview - nested 1
/bookmarks - nested 2
/accountStatement - stacked nested 1 ---> Gives error
/accountStatement/preview - stacked nested 2

@lulupointu
Copy link
Owner

Your code structure is a bit hard to understand since everything is extracted. Could you provide a small reproducible example?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants