Bubble up key events incl. shortcuts that are not handled by PlutoGrid
PlutoGridState registers its own key handler _handleGridFocusKeyOnly via the FocusScope widget and onKeyEvent property. The registered key handler always returns KeyEventResult.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.
@KaushikGupta007
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: https://github.com/bosskmk/pluto_grid/issues/1066 And yes, this PR here fixes it. The Android back button works.
@AdamDreessen Yeah, thanks for the fix. I hope it gets merged soon.
Hey @AdamDreessen,
Back button still not works on filter menu. Do you have fix for this ?
Thanks
@doonfrs Hi there, is this repo actively maintained? Is @bosskmk still involved? I’m the first contributor to pluto_grid_export and an active user, but in order to user latest Flutter versions I recently switched to pluto_grid_plus (#968). What can we expect?
Yo @doonfrs This issue is still in pluto_grid_plus. Should we expect an update soon?
I have implemented it in this forked repo pluto_grid. This uses pluto_grid v7.0.2.
But this pull request still not fixes back button action on filter menu.
@KaushikGupta007 thanks
At this point I put added a button in my header and on click on pop the page, but I still need the backbutton to work to up user experience.
Why fork the old version and not pluto_grid_plus tho?
@KaushikGupta007 thanks At this point I put added a button in my header and on click on pop the page, but I still need the backbutton to work to up user experience. Why fork the old version and not pluto_grid_plus tho?
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
- Add the Upstream PlutoGrid Repository
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.
- Fetch the Latest Changes from PlutoGrid (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.
- Merge the Changes into Your Forked Repository (PlutoGrid Plus)
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.
- Resolve Merge Conflicts (If Any)
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"
- Push the Updates to Your Forked Repository
Once the changes are merged, push them back to your own forked PlutoGrid Plus repository:
git push origin master
- Update Dependencies in Your Flutter Project
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.