-
-
Notifications
You must be signed in to change notification settings - Fork 328
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
Bubble up key events incl. shortcuts that are not handled by PlutoGrid #1070
base: master
Are you sure you want to change the base?
Bubble up key events incl. shortcuts that are not handled by PlutoGrid #1070
Conversation
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.
Will this fix back button not working issue in Android
I cannot tell but might be worth a try. We're using it in a Win/MacOS desktop app. And without this fix we are not able to handle key events (e.g. global shortcuts on app level) outside the PlutoGrid. |
@KaushikGupta007 I just tested the sample app from your bug report: #1066 |
@AdamDreessen Yeah, thanks for the fix. I hope it gets merged soon. |
Hey @AdamDreessen, |
Yo @doonfrs |
I have implemented it in this forked repo pluto_grid. This uses pluto_grid v7.0.2. |
@KaushikGupta007 thanks |
I hadn't tested pluto_grid_plus for any bugs and was using this version long enough to trust this |
Yo will this work? Since you're using the PlutoGrid Plus package, which is forked from the PlutoGrid package, and you're trying to get updates from the PlutoGrid main repository, here's a step-by-step guide on how to update your PlutoGrid Plus fork with the latest changes from the PlutoGrid repository: Steps to Update Your Forked Package
First, you need to make sure that your forked repository (PlutoGrid Plus) knows about the original PlutoGrid repository (often called the "upstream" repository). Run this command to add the upstream PlutoGrid repository (if it's not already added): git remote add upstream https://github.com/bosskmk/pluto_grid.git This adds the main PlutoGrid repository as a remote called upstream.
Now, you'll want to fetch the latest changes from the main PlutoGrid repository: git fetch upstream This downloads all the changes from the upstream repository but doesn't apply them yet.
Switch to the branch of your fork where you want to merge the changes (usually main or master): git checkout master Now, merge the changes from the upstream PlutoGrid repository into your local fork: git merge upstream/master This merges the latest updates from the PlutoGrid main repository into your forked repository.
If there are any merge conflicts, Git will notify you. You will need to manually resolve those conflicts in your code editor, and then continue the merge process. After resolving the conflicts, mark the changes as resolved: git add . Complete the merge: git commit -m "Merged updates from PlutoGrid"
Once the changes are merged, push them back to your own forked PlutoGrid Plus repository: git push origin master
If you're using PlutoGrid Plus as a dependency in your Flutter project, run the following to ensure the changes take effect: flutter pub get Summary Add PlutoGrid as an upstream remote. Fetch and merge the latest changes from PlutoGrid into your PlutoGrid Plus fork. Push the merged updates back to your fork. Run flutter pub get in your project to update the package. This process will bring in the latest changes from the original PlutoGrid into your forked version, PlutoGrid Plus. |
PlutoGridState
registers its own key handler_handleGridFocusKeyOnly
via theFocusScope
widget andonKeyEvent
property. The registered key handler always returnsKeyEventResult.handled
. This prevents parent widgets to use own shortcuts because key events are not "bubbled up" in the widget hierarchy.Pluto Grid defines its own "default actions" and "shortcuts". It is desirable that only these are prevented from "bubbling up" and all other key events are passed on to parent widgets.
With this PR we implemented this behavior in
PlutoGridState._handleGridFocusOnKey
.