Code Monkey home page Code Monkey logo

Comments (6)

kaushikbh99 avatar kaushikbh99 commented on June 4, 2024

I've also tried below method but it doesn't work
appRouter.push(HomeRoute(children: [URNVerificationRoute()]));

from auto_route_library.

lukecastronuevo avatar lukecastronuevo commented on June 4, 2024

Have you already fixed it on your end? I might help you as I have successfully implemented the same logic on my app.

from auto_route_library.

lukecastronuevo avatar lukecastronuevo commented on June 4, 2024

You just need to change few parts on your router.dart file this is what my router.dart looks like

@AutoRouterConfig(replaceInRouteName: 'Screen,Route')
class AppRouter extends $AppRouter {
  @override
  final List<AutoRoute> routes = [
    AutoRoute(path: "/", page: StartupView.page),
    AutoRoute(path: "/navigation", page: NavigationView.page, children: [
      AutoRoute(path: "home", page: HomeView.page),
      AutoRoute(
        path: "learning-hub-navigaton",
        page: LearningNavigationView.page,
        children: [
          AutoRoute(path: "learning-hub", page: LearningHubView.page, initial: true),
          AutoRoute(path: "new-activity", page: NewActivityView.page),
          AutoRoute(path: "activity-info", page: ActivityInfoView.page),
        ],
      ),
      AutoRoute(path: "create-course", page: CreateCourseView.page),
      AutoRoute(path: "settings", page: SettingsView.page),
    ]),
  ];
}

Remember if you are nesting a navigation inside a nested navigation your inner navigation should have a top view dedicated for handling the inner navigation, on my end this is the LearningNavigationView.page, following is the content of this file:

Padding(
      padding: const EdgeInsets.fromLTRB(0, 0, 20, 0),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Container(
           ... // --> this should be your navbar if i'm not mistaken
          ),
          Expanded(child: AutoRouter()) // --> this is important this is where inner navigations will be displayed like some kind of a placeholder --> [ AutoRoute(path: "learning-hub", page: LearningHubView.page, initial: true),
          AutoRoute(path: "new-activity", page: NewActivityView.page),
          AutoRoute(path: "activity-info", page: ActivityInfoView.page),] these screens are displayed here
        ],
      ),
    );

Remember to set an initial page for your inner nested navigation

from auto_route_library.

kaushikbh99 avatar kaushikbh99 commented on June 4, 2024

@lukecastronuevo,
How can you use AutoRoute as children of column widget, can you please explain me?
And how can we navigate inner route in web app?

cc @Milad-Akarie

from auto_route_library.

nokia6290 avatar nokia6290 commented on June 4, 2024

wait so routing for nested in web does not work..?
been trying to use navigate, replace, push - nothing is working

p.s. independent routes work

from auto_route_library.

lukecastronuevo avatar lukecastronuevo commented on June 4, 2024

I have created a sample app with nested navigation.
Check it here:

It's not much, but it might help you with understanding nested navigation in web. Also I can confirm that autoroute works on web.

from auto_route_library.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.