flutter 当文本字段上的键盘打开时,显示白色屏幕

stszievb  于 2023-01-27  发布在  Flutter
关注(0)|答案(1)|浏览(259)

下面是包含文本字段和列表视图的图像。当我点击文本字段键入一些东西时,键盘打开时显示白色。我想在键盘打开时删除此白屏。我尝试了下面的行,但两者都不起作用。
调整大小以避免底部填充:false,调整大小以避免底部插入:假的,

这是我的代码。

return Scaffold
  (
  backgroundColor: Colors.grey[100],
  //resizeToAvoidBottomPadding: false,
  resizeToAvoidBottomInset: false,
  body: Column(
      mainAxisSize: MainAxisSize.min,
      children: <Widget>[
        new Container(
          height: 80.0,
        child: new Row(
          //mainAxisAlignment: MainAxisAlignment.spaceBetween,
          //mainAxisSize: MainAxisSize.max,
          children: <Widget>[
            new Expanded(
              child: new Padding(
                padding: new EdgeInsets.only(left: 10.0, right: 0.0, top: 0.0),
                child: TextField(
                  autocorrect: false,
                  key: homeScaffoldKey,
                  controller: _location_city,
                  decoration: InputDecoration(
                    hintText: "Search by location or zipcode",
                    filled: true,
                    fillColor: Colors.white,
                    enabledBorder: OutlineInputBorder(
                      borderRadius: BorderRadius.all(Radius.circular(10.0)),
                      borderSide: BorderSide(color: Colors.grey),
                    ),
                    focusedBorder: OutlineInputBorder(
                      borderRadius: BorderRadius.all(Radius.circular(10.0)),
                      borderSide: BorderSide(color: Colors.grey),
                    ),
                  ),

                ),

        ),

            ),

            new Padding(
              padding: new EdgeInsets.only(left: 10.0, right: 10.0, top: 0.0),
              //onPressed will show login with the username typed on terminal
              child: new FlatButton(
                  padding: const EdgeInsets.symmetric(
                      vertical: 20.0, horizontal: 15.0),
                  color: Colors.blue[100],
                  onPressed: ()  {
                   

                  }, child: new Text('Filter', style: TextStyle(fontSize: 16, color: Colors.blue),),
                  shape: new RoundedRectangleBorder(borderRadius: new BorderRadius.circular(10.0))
              ),
            )
          ],
        ),
  ),

        Expanded(
            child: FutureBuilder(
                  future: getData(),
                  builder: (context, snapshot)
                  {
                    return snapshot.data != null
                        ? listViewWidget(snapshot.data)
                        : Center(child: CircularProgressIndicator());
                  }

              ),

        ),

      ],

  ),

);

}

qhhrdooz

qhhrdooz1#

转到“脚手架”小部件,然后设置resizeToAvoidBottomInset: false

相关问题