打开键盘时,内容不会被推上去
On opening keyboard the content doesn't get pushed up
我在注册用户页面有6个TextFormField
,当我点击输入一些文字时,键盘打开了,但是内容没有被推上去,所以我看不到我的内容'我在文本框中书写。
我想要推送内容。
请帮忙!
代码如下:
@override
Widget build(BuildContext context) {
return new Scaffold(
resizeToAvoidBottomPadding: false,
appBar: new AppBar(
title: new Text("Register"),
),
body: Card(
child: Padding(
padding: EdgeInsets.all(8.0),
child: Form(
autovalidate: _autoValidate,
key: formKey,
child: new SingleChildScrollView(
child: Column(mainAxisSize: MainAxisSize.max, children: <Widget>[
new TextFormField(
decoration: InputDecoration(labelText: "Username"),
validator: (input) => input.length < 3
? '3 or more char'
: null,
onSaved: (input) => globals.userName = input,
),
new TextFormField(
obscureText: true,
decoration: InputDecoration(labelText: "Password"),
validator: (input) => input.length < 8
? 'min 8 char'
: null,
onSaved: (input) => globals.passWord = input,
),
new TextFormField(
decoration: InputDecoration(labelText: "Firstname"),
validator: (input) =>
input.length <= 1 ? 'Input your name' : null,
onSaved: (input) => globals.firstName = input,
), //First Name TextBox
new TextFormField(
decoration: InputDecoration(labelText: "Lastname"),
validator: (input) =>
input.length <= 1 ? 'Input your last name' : null,
onSaved: (input) => globals.lastName = input,
), //Last Name TextBox
new TextFormField(
decoration: InputDecoration(labelText: "Email"),
onSaved: (input) => globals.eMail = input,
validator: _validateEmail,
keyboardType: TextInputType.emailAddress,
),
new TextFormField(
decoration: InputDecoration(labelText: "Phone"),
validator: (input) =>
input.length != 10 ? 'Input your phone' : null,
onSaved: (input) => globals.pHone = input,
),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
Padding(
padding: const EdgeInsets.all(8.0),
child: RaisedButton(
onPressed: _submit,
child: Text("Registruj se"),
) //Submit Button
),
_showErrorMessage(),
],
)
]),
),
),
),
),
);
}
删除:resizeToAvoidBottomPadding: false
从脚手架解决了这个问题。
我在注册用户页面有6个TextFormField
,当我点击输入一些文字时,键盘打开了,但是内容没有被推上去,所以我看不到我的内容'我在文本框中书写。
我想要推送内容。
请帮忙!
代码如下:
@override
Widget build(BuildContext context) {
return new Scaffold(
resizeToAvoidBottomPadding: false,
appBar: new AppBar(
title: new Text("Register"),
),
body: Card(
child: Padding(
padding: EdgeInsets.all(8.0),
child: Form(
autovalidate: _autoValidate,
key: formKey,
child: new SingleChildScrollView(
child: Column(mainAxisSize: MainAxisSize.max, children: <Widget>[
new TextFormField(
decoration: InputDecoration(labelText: "Username"),
validator: (input) => input.length < 3
? '3 or more char'
: null,
onSaved: (input) => globals.userName = input,
),
new TextFormField(
obscureText: true,
decoration: InputDecoration(labelText: "Password"),
validator: (input) => input.length < 8
? 'min 8 char'
: null,
onSaved: (input) => globals.passWord = input,
),
new TextFormField(
decoration: InputDecoration(labelText: "Firstname"),
validator: (input) =>
input.length <= 1 ? 'Input your name' : null,
onSaved: (input) => globals.firstName = input,
), //First Name TextBox
new TextFormField(
decoration: InputDecoration(labelText: "Lastname"),
validator: (input) =>
input.length <= 1 ? 'Input your last name' : null,
onSaved: (input) => globals.lastName = input,
), //Last Name TextBox
new TextFormField(
decoration: InputDecoration(labelText: "Email"),
onSaved: (input) => globals.eMail = input,
validator: _validateEmail,
keyboardType: TextInputType.emailAddress,
),
new TextFormField(
decoration: InputDecoration(labelText: "Phone"),
validator: (input) =>
input.length != 10 ? 'Input your phone' : null,
onSaved: (input) => globals.pHone = input,
),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
Padding(
padding: const EdgeInsets.all(8.0),
child: RaisedButton(
onPressed: _submit,
child: Text("Registruj se"),
) //Submit Button
),
_showErrorMessage(),
],
)
]),
),
),
),
),
);
}
删除:resizeToAvoidBottomPadding: false
从脚手架解决了这个问题。