I have a form with multiple text fields and dropdowns. When I switch the focus between different textfields, the focus changes as expected.
But when a textfield has focus and right after I tap on a dropdown, the soft keyboard is dismissed and the focus is back in the textfield. The dropdown does not open on first tap. Only when I tap the dropdown again the textfield looses focus and the dropdown opens.
When the focus was not in the textfield before, tapping once on the dropdown opens it as expected.
Is there a way the make the dropdown open on first tap?
Same question asked here:
Flutter / Android - moving focus from a dropdownbutton to a textField
And there is also some discussion on it here:
https://github.com/flutter/flutter/issues/22075
Related
Unsuccessful alternatives:
Unfocus current primary focus --> Loosing focus
Unfocus current primary focus and requesting focus again --> Keyboard gets opened again
Setting textInputAction to TextInputAction.done --> Loosing focus
* When keyboard is opened and user tap into Android back button, then the behaviour is the one I want: Keyboard gets closed but focus remains on textfield.
I need to achieve that in:
a) Flutter Android projects.
b) Flutter Web projects executed in Android devices.
I have a problem with the keyboard in this case. When I ask to focus on the TextButton, the keyboard is disappearing.
I'm creating a page that once the user enter, there will be a textfield which allow user to add point, is there anyway I can always allow my keyboard appear without user clicking textfield only appear?
Below images is after I click the textfield it only appear keyboard.
To give focus to a text field as soon as it’s visible, use the autofocus property.
TextField(
autofocus: true,
);
So whenever the widget appears on screen, if theres nothing else with the keyboard focus, the focus will automatically be directed to it, thus opening the keyboard.
How can I implement default android Messages like a custom widget in place of the keyboard shown in the GIF?
When you tap on + button, what happens is,
Keyboard Closed, to achieve this you can use FocusNode instance and assign in TextField, to unfocus or to close keyboard, you can achieve it by focusNode.unfocus().
The content you see on tap of + is outside keyboard, i.e. you have to create widget and change it's visibility accordingly, Visibility can be used.
In other case misc options is visible and user tap on keyboard icon then change visibility of extra options and obtain focus of FocusNode instance(enable keyboard), by focusNode.requestFocus().
Am I doing something wrong with this super simple app?
I have CupertinoTabView with two tabs. The first one shows a Page which holds a textfield. Problem is when I tap on the textfield, the keyboard is showing for a fraction of a second and then hides again.
Link to issue on flutter github