【问题标题】:Where to put Expanded inside Form Widget在表单小部件中放置扩展的位置
【发布时间】:2020-05-31 17:30:04
【问题描述】:

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

我想知道我应该将 Expanded 小部件放在此代码中的确切位置以避免此错误:

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。 @亚历克斯阿里
  • 谢谢@T.TSage ...确实比使用Expanded容易得多

标签: flutter dart widget


【解决方案1】:

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

下面的例子:

Scaffold(
      resizeToAvoidBottomInset: false,
    );

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-07-25
    • 2014-03-06
    • 1970-01-01
    • 2023-03-23
    • 1970-01-01
    相关资源
    最近更新 更多