打开键盘时,内容不会被推高

时间:2019-01-30 17:46:23

标签: dart flutter textfield

在注册用户页面上我有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(),
              ],
            )
          ]),
        ),
      ),
    ),
  ),
 );
  }

1 个答案:

答案 0 :(得分:0)

删除:{@ {1}}已修复此问题。