在哪里放置 Expanded inside Form Widget

Where to put Expanded inside Form Widget

我有这个登录表单,当我按下第二个 RaisedButton 时,键盘出现,显示小部件中出现问题的 yellow/black 横幅。

我想知道在这段代码中我应该把 Expanded widget 放在哪里才能避免这个错误:

body: Container(
    padding: EdgeInsets.symmetric(vertical: 20.0, horizontal: 50.0),
    child: Form(
      key: _formKey,
      child: Column(
        children: <Widget>[
          SizedBox(height: 20.0),
          TextFormField(),
          SizedBox(height: 20.0),
          TextFormField(),
          SizedBox(height: 20.0),
          RaisedButton(),
          SizedBox(height: 12.0),
          Text(''),
          RaisedButton(),
          ),
        ],
      ),
    ),
  ),

您可以通过将 resizeToAvoidBottomInset: false 添加到根 Scaffold 来解决此问题。

示例如下:

Scaffold(
      resizeToAvoidBottomInset: false,
    );