How to shift focus to next textfield in flutter?

前端 未结 7 2099
甜味超标
甜味超标 2020-12-04 23:36

I am new to Flutter.

I am building a form with multiple text inputs using following widgets: Form, TextFormField. The keyboard that appears doesn\'t show \"next\" (w

相关标签:
7条回答
  • 2020-12-05 00:18

    For TextFormFeild use can use onFieldSubmitted

    TextFormField(
              decoration: InputDecoration(hintText: "Username"),
              textInputAction: TextInputAction.next,
              onFieldSubmitted: (_) => FocusScope.of(context).nextFocus(), // focus to next
            ),
    TextFormField(
              decoration: InputDecoration(hintText: "Password"),
              textInputAction: TextInputAction.done,
              onFieldSubmitted: (_) => FocusScope.of(context).unfocus(), // Unfocus and hide keyboard
            ),
    
    0 讨论(0)
提交回复
热议问题