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

ReOpen keyboard #92

Closed
YaroslavGS opened this issue Aug 14, 2020 · 4 comments
Closed

ReOpen keyboard #92

YaroslavGS opened this issue Aug 14, 2020 · 4 comments

Comments

@YaroslavGS
Copy link

Hello, I found a problem: if our textfield is in focus and we click on the field for entering the pincode again, the keyboard will reopen. I think this is not very good behavior and in this case the keyboard should remain open and not reopened. I tried to fix it myself, but then I ran into a problem when we close the keyboard with the system pop, then it stops opening altogether, since the focus of the node remains in focus. And processing through WidgetsBindingObservers and didChangeMetrics & MediaQuery.of (context) .viewInsets.bottom did not lead to any positive results.

@YaroslavGS
Copy link
Author

Well, I fixed this problem ... by adding _onFocus to the callback
checking for the current keyboard height
if (MediaQuery.of (context) .viewInsets.bottom == 0) {
_focusNode.unfocus;
}
earlier there was a problem with the fact that the keyboard was called with a different context and, accordingly, in the context of the widget itself, it was not possible to correctly handle this situation.
Therefore, I propose to add an additional parameter to the constructor to the BuildContext widget so that the user can pass it in and the focusnode is called with the correct context. It may also fix other potential problems in the future.

@adar2378
Copy link
Owner

Hey Thanks for figuring this out!!! It would be lovely if you could create a pull request with your solution!

@adar2378
Copy link
Owner

Hey I've used your logic and fixed the issue in the new update :) Thanks for the suggestion.

@aggeloskoutanis
Copy link

aggeloskoutanis commented Jun 22, 2023

I am still getting this problem in the latest version. On the _onFocus method that you have implemented, for some reason _focusNode!.hasFocus always returns false, even if the field is has the focus.

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

No branches or pull requests

3 participants