当我单击 TextFormField 时,键盘出现,然后它立即消失,就像闪烁一样。我想知道是否是因为缺少一些参数?还是其他一些问题?谢谢。这是我的相关代码。
final _formKey = GlobalKey<FormState>();
String? _account;
Widget _showAccountInput() {
return Padding(
padding: const EdgeInsets.fromLTRB(15.0, 10.0, 0.0, 0.0),
child: new TextFormField(
maxLines: 1,
obscureText: true,
autofocus: false,
style: TextStyle(fontSize: 15),
decoration: new InputDecoration(
border: InputBorder.none,
hintText: 'input',
icon: new Icon(
Icons.lock,
color: Colors.grey,
)),
onSaved: (value) => _account = value?.trim(),
),
);
}
Widget build(BuildContext context) {
// TODO: implement build
return Scaffold(
appBar: new AppBar(
title: new Text("Second Screen"),
),
body: Form(
key: _formKey,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
_showAccountInput()
],
),
),
);
}
}