How to shift focus to next textfield in flutter?

前端 未结 7 2138
甜味超标
甜味超标 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:05

    I used onSubmitted instead of onFieldSubmitted

    Example code

          TextField(
                    textInputAction: TextInputAction.next,
                    onSubmitted: (_) => FocusScope.of(context).nextFocus(),
                    controller: _phoneController,
                    decoration: const InputDecoration(
                      labelText: 'Phone number',
                    ),
                    style: TextStyle(fontSize: 16.0, color: Colors.white),
                  ),
    

提交回复
热议问题