pluto_grid icon indicating copy to clipboard operation
pluto_grid copied to clipboard

Bubble up key events incl. shortcuts that are not handled by PlutoGrid

Open AdamDreessen opened this issue 1 year ago • 10 comments

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.

AdamDreessen avatar Jun 14 '24 11:06 AdamDreessen

@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.

AdamDreessen avatar Jun 18 '24 18:06 AdamDreessen

@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 avatar Jun 19 '24 07:06 AdamDreessen

@AdamDreessen Yeah, thanks for the fix. I hope it gets merged soon.

KaushikGupta007 avatar Jun 19 '24 07:06 KaushikGupta007

Hey @AdamDreessen, Back button still not works on filter menu. Do you have fix for this ? 240729831-6a78d25b-d4e2-43cc-a781-77341d00cb81 Thanks

KaushikGupta007 avatar Jul 17 '24 12:07 KaushikGupta007

@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?

henry2man avatar Oct 09 '24 14:10 henry2man

Yo @doonfrs This issue is still in pluto_grid_plus. Should we expect an update soon?

Jakuzeisme avatar Oct 09 '24 15:10 Jakuzeisme

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. 240729831-6a78d25b-d4e2-43cc-a781-77341d00cb81

KaushikGupta007 avatar Oct 09 '24 15:10 KaushikGupta007

@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?

Jakuzeisme avatar Oct 09 '24 16:10 Jakuzeisme

@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

KaushikGupta007 avatar Oct 09 '24 16:10 KaushikGupta007

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

  1. 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.

  1. 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.

  1. 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.

  1. 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"

  1. 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

  1. 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.

Jakuzeisme avatar Oct 09 '24 16:10 Jakuzeisme