【发布时间】:2019-02-11 05:17:22
【问题描述】:
我有表格可以从用户那里获取信息。但是当我点击 TextFormField 和键盘显示它消失了。
这是我的代码:
class _AddInfoState extends State<AddInfo>{
static final GlobalKey<FormState> _key = new GlobalKey();
bool _validate = false;
String strTitle;
File fileImage;
@override
Widget build(BuildContext context) {
// TODO: implement build
return Scaffold(
body:new Container(
child: new Form(
key: _key,
autovalidate: _validate,
child: formUI(),
),
),
);
}
Widget formUI(){
return new ListView(
children: <Widget>[
//Title Field
new Container(
padding: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 0.0),
child:new TextFormField(
style: styleTextField,
keyboardType: TextInputType.text,
autofocus: true,
maxLength: 45,
decoration: InputDecoration(
hintText: 'Enter Title',
prefixIcon: Icon(
Icons.title,
size: 30.0,
color: blueColor,
)
),
validator: validateTitle,
onSaved: (String val) {
strTitle = val;
},
),
),
],
physics: new ClampingScrollPhysics(),
);
}
【问题讨论】:
-
能否请您添加一张它在消失之前和之后的外观的屏幕截图,如果我们也能直观地知道发生了什么,它将更容易为您提供帮助。
标签: dart flutter flutter-layout