[英]Flutter Cursor Appearing in two fields at the same time
我對顫振 textformfield 有問題。 就像我在標題中所說的那樣,我的應用程序在兩個文本表單字段中顯示光標。 當我點擊上一個文本字段時它會出現。 我用的是真機測試,沒有在模擬器上試過。 謝謝你的幫助。 這是我的應用程序中的圖像:在此處輸入圖像描述
Form(
key: _formKey,
child: Column(
children: <Widget>[
SizedBox(
height: 20.0,
),
TextFormField(
decoration: InputDecoration(labelText: 'Email'),
focusNode: _emailFocus,
onFieldSubmitted: (term) {
_passwordFocus.nextFocus();
_fieldFocusChange(
context, _emailFocus, _passwordFocus);
},
textInputAction: TextInputAction.next,
validator: (value) =>
value.isEmpty ? 'Enter an email' : null,
onChanged: (value) {
setState(() => email = value);
},
),
SizedBox(
height: 20.0,
),
TextFormField(
decoration: InputDecoration(labelText: 'Password'),
validator: (value) => value.length < 6
? 'Enter an password 6+ chars long'
: null,
obscureText: true,
focusNode: _passwordFocus,
onFieldSubmitted: (term) {
_passwordFocus.unfocus();
_submitForm();
},
textInputAction: TextInputAction.done,
onChanged: (value) {
setState(() => password = value);
},
),
SizedBox(
height: 20.0,
),
RaisedButton(
color: Theme.of(context).primaryColor,
child: Text('Sign in'),
onPressed: () {
_submitForm();
},
),
SizedBox(height: 12.0),
Text(error,
style:
TextStyle(color: Colors.red, fontSize: 14.0)),
],
)),
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.