Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

AdamDreessen
Copy link

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.

Copy link

@KaushikGupta007 KaushikGupta007 left a 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

@AdamDreessen
Copy link
Author

AdamDreessen commented Jun 18, 2024

@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
Copy link
Author

@KaushikGupta007 I just tested the sample app from your bug report: #1066
And yes, this PR here fixes it. The Android back button works.

@KaushikGupta007
Copy link

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

@KaushikGupta007
Copy link

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

@henry2man
Copy link
Contributor

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

@Jakuzeisme
Copy link

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

@KaushikGupta007
Copy link

KaushikGupta007 commented Oct 9, 2024

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

@Jakuzeisme
Copy link

@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
Copy link

@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

@Jakuzeisme
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants