Closed fralways closed 9 months ago
Using your code, I see that the FocusNode listener is not called when clicking the Android "down arrow" button to dismiss the keyboard, but it is called when clicking the checkmark in the keyboard. I'll try to figure out what the desired behavior is.
Besides the event, I think that visually keeping the cursor in the input after dismissing the keyboard is desired, though. I see the same behavior in native Android.
If keeping the cursor in the input in that case is desired then it explains why focus node doesn't push new event after keyboard dismiss and why this approach doesn't handle all use cases. Then I would need some other way to listen for keyboard change and I do not know any other listener for that. Something like UIKeyboardWillShowNotification
and UIKeyboardWillHideNotification
in iOS. Am I missing something? I would suggest to either expand listener for focus node so that we can listen for keyboard change events as well or to have some completely different listener for keyboard change events.
@gspencergoog This is the focus issue I mentioned to you. Will your work affect this at all?
No, this won't be affected by my work. I don't know of a way to listen for the keyboard show/hide events at the moment, but that would be a good addition, especially since the platform can hide the keyboard independent of losing focus.
In latest stable (1.20.2) using given code sample, tapping on down arrow key keeps the cursor focused in textfield, while tapping on Done on keyboard removes the cursor focused. Tested on Android 8.1.0 device.
I have the same issue on Android. I show an overlay with a complex widget of search results for a search field. I would like to hide the overlay when the user dismisses the keyboard, however it can only be closed using the check icon on the keyboard. I have other controls on the page (slider) but those does not seem to grab the focus when used so I am stuck with an always open search box. Is there a workaround or any suggestion that I could implement? Thanks for the help.
I can reproduce the issue on the latest stable and the master channel, On tapping the Android back button the cursor still stays inside the TextField but on submitting (click the check icon on the keyboard) the TextField loses focus completely (cursor disappears). I verified the behavior in a few other apps like Instagram and youtube, Both seem to have the cursor on pressing the back button. While Whatsapp, does remove the cursor on pressing the back button, So Perhaps being able to configure this behavior would be ideal.
Youtube | Flutter | |
---|---|---|
You could use MediaQuery.viewInsets for keyboard visibility
Without additional information, we are unfortunately not sure how to resolve this issue. We are therefore reluctantly going to close this bug for now. If you find this problem please file a new issue with the same description, what happens, logs and the output of 'flutter doctor -v'. All system setups can be slightly different so it's always better to open new issues and reference the related ones. Thanks for your contribution.
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v
and a minimal reproduction of the issue.
When using Android simulator Nexus5X API 27 tapping on ('Android') button to dismiss keyboard doesn't remove focus from TextField thus preventing layout update after keyboard is dismissed. I have not found other way to listen for keyboard dismiss, and would expect that this is the correct way to do it. I guess this is an issue for all devices which have button to dismiss keyboard.
Steps to Reproduce
Logs