Comments (4)
Hey @Bizz first for all, thanks for all the great tuts! keep them coming!
please help me understand what's going on here.
CupertinoTabView is just a wrapper for Navigator, is every tab you in your App a nested navigator?
if yes, are you trying to use the same router for all the nested navigators you have?
Where is this page JobEntriesPage supposed to show?
from auto_route_library.
@Milad-Akarie thank you.
Yes, my goal is to have nested navigators.
For context, this is an implementation of my code that doesn't use auto_route
:
class CupertinoTabViewRoutes {
static const jobEntriesPage = '/job-entries-page';
}
class CupertinoTabViewRouter {
static Route generateRoute(RouteSettings settings) {
switch (settings.name) {
case CupertinoTabViewRoutes.jobEntriesPage:
final job = settings.arguments;
return CupertinoPageRoute(
builder: (_) => JobEntriesPage(job: job),
settings: settings,
fullscreenDialog: true,
);
}
return null;
}
}
class CupertinoHomeScaffold extends StatelessWidget {
CupertinoHomeScaffold({
Key key,
@required this.currentTab,
@required this.onSelectTab,
@required this.widgetBuilders,
@required this.navigatorKeys,
}) : super(key: key);
final TabItem currentTab;
final ValueChanged<TabItem> onSelectTab;
final Map<TabItem, WidgetBuilder> widgetBuilders;
final Map<TabItem, GlobalKey<NavigatorState>> navigatorKeys;
@override
Widget build(BuildContext context) {
return CupertinoTabScaffold(
tabBar: CupertinoTabBar(
key: Key(Keys.tabBar),
items: [
_buildItem(TabItem.jobs),
_buildItem(TabItem.entries),
_buildItem(TabItem.account),
],
onTap: (index) => onSelectTab(TabItem.values[index]),
),
tabBuilder: (context, index) {
final item = TabItem.values[index];
return CupertinoTabView(
navigatorKey: navigatorKeys[item],
builder: (context) => widgetBuilders[item](context),
onGenerateRoute: CupertinoTabViewRouter.generateRoute,
);
},
);
}
Would it make sense for me to have three ExtendedNavigator<Router>(router: Router()))
, instead of the current widgetBuilders
?
from auto_route_library.
@bizz84 Of course it would, like I said CupertinoTabView is just a wrapper for Navigator.
This's how I image your setup to be
tabBuilder: (context, index) {
final item = TabItem.values[index];
return ExtendedNavigator(
key: navigatorKeys[item]
router: nestedRouters[item],
);
},
also If I understand your code correctly, the builder in CupertinoTabView is just responsible for building you initial page which simply could be your initial route. so you don't actually need the builder
from auto_route_library.
@Milad-Akarie that makes sense. Thanks for the explanation :)
from auto_route_library.
Related Issues (20)
- AutoTabsRouterTabBarState was disposed with active Ticker HOT 2
- customRouteBuilder's completion result type has broken in the 8.0.3 version HOT 4
- Wildcards explanation is wrong HOT 2
- Allow empty paths without making them initial? HOT 4
- Missing Back Button after refresh on web HOT 9
- Issue with Global Constants as Default Values in Route Generation HOT 1
- Unable to access ` tabsRouter` from Tab's child to navigate to desired index
- Severe bug: Query parameters are not being encoded HOT 2
- inconsistent back button in app bar when using child routes HOT 1
- AutoRouterDelegate.declarative is deprecated - use guards instead - no docs? HOT 8
- Explicit Type Casting for Route Assignments HOT 1
- context.router.pushNamed is not working HOT 2
- Issue with screen going blank after navigating back from nested routes with wrappers in version 8.0.0 HOT 2
- Can not swipe back on iOS when using nested navigation HOT 10
- Question: Access BuildContext from within AutoRouteGuard HOT 1
- Redirect on arg parsing fail HOT 5
- Back button on Android closes App on Sub route
- Implement Persist Navigation State Feature
- Back navigation blank issue still persists in 8.1.1 HOT 1
- removeWhere removes the wrong route HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from auto_route_library.