Issue
I have a TextField
in Flutter of which I want to automatically select the text and show the keyboard.
I can select the text through a TextEditingController
, but even with a FocusNodes
requestFocus the keyboard isn't shown, when the Widget opens.
How to automatically open the keyboard for a TextField?
Solution
You can use the autofocus:true
property of the TextField:
Whether this text field should focus itself if nothing else is already focused.
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.
TextField(TextEditingController: controller,
focusNode: focusNode,
autofocus:true)
Answered By - Naslausky
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.