I have two textFormField
widgets. Once the user has completed the first text field I would like to focus on the next textField
. Is there a way to do this in Flutter? Currently, the done button just closes the keyboard. I was guessing the focusNode
class might be the answer to this but not really sure how that works does anyone have any good examples of focusNode class? Thanks in advance.
Flutter – Changing focus from one text field to the next in Flutter
dartflutter
Best Answer
Yes, FocusNode and the
onFieldSubmitted
from a TextFormField are probably the way to go.Here is an example that may help:
You may also want to trigger
FocusScope.of()
from a button rather than onFieldSubmitted, but hopefully the above example gives you enough context to construct an appropriate solution for your use case.