Closed tejHackerDEV closed 1 year ago
Hi @tejHackerDEV,
I made an example on what did you describe. And it is work as expected. Can you check this?
Hi @SchabanBo,
As I said before I am using bottomNavigationBar & I am using QR.toName() instead of QR.to(). Also please find the below reproducible code of the issue which is an modification of your bottomNavigation examples which you hosted on your GitHub for qlevar As you can check the url is updating to settings no matter from which page I enter & clicking on address bar of the url it takes me back to the correct page but clicking on the arrow button on the appBar will take me to the settings page itself which is wrong in my manner. So in my observation I feel that QR.toName() will matches the last registered route with that particular name, but in some cases it will be wrong(like the one I posted now). So I think first we need to check the current route children's if no match found then we need to go out of the parent routes & then needs to match.
When you run the app, the package adds all name in a unique list as Tree Info to the routes in the app. When you use the same name for multiple routes, the name will be overwritten be the next route with the same name. You can see in the tree Info the route with the name 'productDetail' is '/home/settings/product'. That is why this is happening.
In short, the name of the routes must be unique
When you run the app, the package adds all name in a unique list as Tree Info to the routes in the app. When you use the same name for multiple routes, the name will be overwritten be the next route with the same name. You can see in the tree Info the route with the name 'productDetail' is '/home/settings/product'. That is why this is happening.
In short, the name of the routes must be unique
Can't it happen by checking the parents route names too instead of simply checking the current route name because there might be multiple pages in a app but from multiple pages we can enter into one single route, so we can't have multiple route names for the same page right.
So I think we can add this to a feature request
I don't think that would be a good idea, Every page should have a single unique route, if the route is different, that is mean this is a different page.
So can you suggest anything for this kind of navigation?
You can use QR.to for this case, or give the productDetail page a different name on every level.
Hi @SchabanBo, There is an issue in Nested navigation when using going to a child page from DifferentParents. Below is the route example
final route = QRoute.withChild( path: '/dashboard', name: dashboard, initRoute: home, builderChild: (router) => DashboardPage(router), children: [ QRoute( path: '/home', name: home, builder: () => const Material(child: HomePage()), children: [ QRoute( path: '/product/:productId', name: productDetail, builder: () => const Material(child: ProductPage()), ), ], ), QRoute( path: '/my-products', name: myProducts, children: [ QRoute( path: '/product/:productId', name: productDetail, builder: () => const Material(child: ProductPage()), ), ], builder: () => const Material(child: MyProducts()), ), ], );
An DashboardPage which contains a bottom nav with Home & MyProduct as bottom nav items & in both Home & MyProducts Page there is a listing of products as cards through which user can enter into that particular ProductDetailPage.
Issue:-
HomePage -> ProductDetail -> (onBack) -> (Landing on) MyProductPage ---------- But should land on HomePage itself MyProductPage -> ProductDetail -> (onBack) -> (Landing on) MyProductPage ---------- Which is fine
So I think no matter from which page I enter into the ProductDetailPage on back from that page returning me to MyProductPage itself.