This function takes a string argument which is the current value of its associated input field, and it's called when a user clicks the keyboard action key.įor name, phone, and email input fields, the onFieldSubmitted function is used to pass keyboard focus to the next input field when a user clicks the action key. The above code update added the onFieldSubmitted function property to the TextFormField widgets. We have four FocusNode objects ( _nameFocusNode, _phoneFocusNode, _emailFocusNode, and _passwordFocusNode) declared, initialized and passed to the four TextFormField widgets in our form respectively. Here, a FocusNode object allows keyboard focus to be obtained and pass around amongst input fields. The focusNode property of every TextFormField widget in the Form is assigned a FocusNode object to make the form easily navigable from one input field to another. KeyboardType: TextInputType.emailAddress, + Scaffold.of(context).showSnackBar(SnackBar(content: + FocusScope.of(context).requestFocus(focusNode) + final FocusNode _passwordFocusNode = FocusNode() + final FocusNode _emailFocusNode = FocusNode() + final FocusNode _phoneFocusNode = FocusNode() + final FocusNode _nameFocusNode = FocusNode() Step 3: Make the Form Navigable and Submittable via the Keyboard’s Action Key. labelText: a descriptive label text, shown when the text field has focus or not empty.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |