Comments (6)
@bounty1342 should be fixed in auto_route: 0.4.2, check it out.
from auto_route_library.
You should add it to the documentation, I was still adding it to the MaterialApp.
builder: ExtendedNavigator<Router>(
router: Router(),
key: MyNavigationService.navKey,
observers: [HeroController()],
)
@ResoCoder : might be good to update the tutorial a bit, most is still valid.
from auto_route_library.
Hey, @bounty1342 I'm glad you're liking the package.
passing your own key isn't required anymore, you can easily obtain the current navigation state without context using
ExtendedNavigator.ofRouter<Router>()
It was mentioned in the updated README file
from auto_route_library.
My service was using navKey, but I changed it.
Only remaining issue is with onWillPop that is not triggered anymore, any recommendation ?
@override
Widget build(BuildContext context) {
return WillPopScope(
onWillPop: () => _exitApp(context),
NavigationService navigationProvider =
Provider.of<NavigationService>(context, listen: false);
if (!navigationProvider.hasNoRoute()) {
navigationProvider.navigationBack();
return Future.value(false);
}
return showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: new Text(I18n.of(context).exitApplicationQuestionTitle),
content: new Text(I18n.of(context).exitApplicationQuestionLbl),
actions: <Widget>[
FlatButton(
onPressed: () => Navigator.of(context).pop(false),
child: new Text(I18n.of(context).exitApplicationQuestionNoBtn),
),
FlatButton(
onPressed: () => Navigator.of(context).pop(true),
child: new Text(I18n.of(context).exitApplicationQuestionYesBtn),
),
],
);
});
}
from auto_route_library.
@bounty1342 can I see your MaterialApp setup?
also may I ask, why do you need a navigation service if you're gonna Provide it with context?
why not use ExtendedNavigator.of(context)? the ExtendedNavigator state is already provided in the context
from auto_route_library.
My MaterialApp setup below :
child: MaterialApp(
localizationsDelegates: [
_localeOverrideDelegate,
const I18nDelegate(),
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
],
supportedLocales: MyI18nDelegate.supportedLocals,
debugShowCheckedModeBanner: appConfig.debugShowCheckedModeBanner,
title: appConfig.appName,
theme: themeService.getTheme(),
darkTheme: themeService.getThemeDark(),
builder: ExtendedNavigator<Router>(
router: Router(),
)),
I use a MVVM pattern, the services know nothing about the context. This is to enforce between the logic and the UI.
issue #47, seems to be related.
Regards,
from auto_route_library.
Related Issues (20)
- Route classes not generated HOT 1
- AutoRoute Helper not available with Android Studio Giraffe | 2022.3.1 Patch 2 HOT 6
- system "back" button close app in nested navigation HOT 4
- [Question] Shouldn't usesPathAsKey work in this case ? HOT 8
- AutoTabsRouter caches the pages. HOT 3
- Widget Inspector Error with Wildcard RedirectRoute HOT 2
- resolver.next(true) in Guard, on browser refresh pushes to initial route
- Route Arguments are always null inside AutoRouterObserver when using navigateNamed HOT 1
- AppBar back button disappears when pressing F5 on a web page
- Can't register AutoRoute v6 with GetIt HOT 2
- TabsRouter: updating `homeIndex` has no effect
- Testcases for Bottom Navigation Bar that uses AutoRouterScaffold HOT 2
- Conditional Transition Animation Based on Previous Route HOT 1
- Deeplink in CamelCase doesn't match
- Navigation doesn't work properly, if `AutoRouteGuard.onNavigation` method is overridden as async method HOT 3
- bug: null check exceptions in `TabController` listener
- `AutoRouterObserver` doesn't work properly when a deeplink is received HOT 5
- keep a splash screen in the route stack
- resolver.next(false) redirect to a white screen
- Flutter AutoRoute Issue: Blank Screen and Data Loss on Browser Refresh
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.