-
Notifications
You must be signed in to change notification settings - Fork 60
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
navigator key added #232
navigator key added #232
Conversation
you just need to add |
This would be a great feature. I was reviewing your code, why did you import lib/app.dart? @tomgilder could you review this? My use case would be in the situation where you want to send in-app notifications. These snack bars depend on the current context and as of now, it needs to be passed around to keep it up to date with the current page. In some situations, the context is not current and so we get an error looking up a deactivated widget. If we had access to the current context for any page it would be a lot simpler to build out a notification handler. And there are plenty of other use cases such as the one @xoltawn mentioned in his last PR. Let's get this pushed through, this is a great addition to the package. |
@anthonysette importing the file must be an accident. I'm gonna remove it and push again |
That would be great! We need to get a reviewer in here to close the PR. Once the fix is up I will test it, but I love this idea! |
@anthonysette I just don't understand. I run |
@tomgilder Can we merge this? The community would benefit a lot from this! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have tested and am currently using these changes in production. This PR is solid. There have been no issues.
@tomgilder Will this be merged? |
@BazinC changes are made to solve the issues you mentioned |
Hi @xoltawn @anthonysette I've added this a slightly different way in PR #262. Providing a final navigatorKey = GlobalKey<NavigatorState>();
final delegate = RoutemasterDelegate(
navigatorKey: navigatorKey,
routesBuilder: (_) => RouteMap(
routes: {
'/': (_) => const MaterialPageOne(),
'/two': (_) => const MaterialPageTwo(),
},
),
);
// Get the current context
final context = navigatorKey.currentContext!;
// Pop the navigator
navigatorKey.currentState!.pop(); |
It is related to this issue:
#195
I sent a pull request earlier but it has conflicts with main branch. so I send another PR regarding that issue
(sorry for the delay)