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

feat: Improved keyboard behaviour on Android #397

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

LizaPolishchuk
Copy link

No description provided.

Added show and hide menu callbacks;
@LizaPolishchuk
Copy link
Author

Hide keyboard on Android when menu shown, also added parameter shouldReopenKeyboard to reopen it, when menu hidden;
Also added onMenuShown and onMenuHidden callbacks to have ability to users to add some custom @code on this actions.

2024-07-23.15.39.48.mp4

@knopp knopp changed the title Improved keyboard behaviour on Android; feat: Improved keyboard behaviour on Android Jul 24, 2024
@knopp
Copy link
Collaborator

knopp commented Jul 24, 2024

Thank you for the PR. I like the idea in generall and this basically replicates what already happens on iOS, however I don't like that this requires unfocusing. It would worth figuring out if we can hide the keyboard without unfocus (same behavior as iOS).

@LizaPolishchuk
Copy link
Author

LizaPolishchuk commented Jul 27, 2024

@knopp Hello! Thanks for review, sure we achieve the same behaviour using native methods:

SystemChannels.textInput.invokeMethod('TextInput.hide') and SystemChannels.textInput.invokeMethod('TextInput.show');

but in this case - we need to check if the keyboard was visible before we hide it to understand do we need to reopen it. But for that need to add package [https://pub.dev/packages/flutter_keyboard_visibility] .

I am not sure that you will approve adding some additional libraries to your package

@knopp
Copy link
Collaborator

knopp commented Aug 1, 2024

Instead of adding a dependency that is only used on one platform, I'd probably go with implementing a method channel call handler in SuperNativeExtensionsPlugin that'd query whether keyboard is visible. Looking at flutter_keyboard_visibility they seem to do it simply based on ratio of windowVisibleDisplayFrame / root view.

We only need a very small part of the plugin functionality and only one one platform, that's why I don't want to introduce a dependency for this.

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.

2 participants