一尘不染

底部溢出30px

flutter

我通过包装面临的一个问题TextFieldnew Expanded()。当尝试搜索textfield其内容时,显示出底部溢出30px。下面是我的代码:

 Widget build(BuildContext context) {
    return new Scaffold(
        body:
      Column(
        children: <Widget>[
          Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: <Widget>[
              IconButton(icon: Icon(Icons.search), onPressed: () {
                setState(() {

                });
              }),
              new Flexible(
                child: new TextField(
                  onChanged: (String value) {
                    onchange(value);
                  },
                  maxLines: 1,
                  autocorrect: true,
//                  decoration: const InputDecoration(helperText: "Search"),
                  style: new TextStyle(fontSize: 10.0, color: Colors.black),
                ),
              ),
              _text != null ? IconButton(
                  icon: Icon(Icons.close), onPressed: (){
              }) : new Container(),

              IconButton(icon: Icon(Icons.bookmark_border), onPressed: () {}),
            ],
          ),
          new Expanded(
              child: FilstList(searchtext: _text,)
          ),


        ],
      ),
    );
  }
}

阅读 289

收藏
2020-08-13

共1个答案

一尘不染

两个 解决方案。

  1. 添加resizeToAvoidBottomPadding: false到您的Scaffold
        Scaffold(
     resizeToAvoidBottomPadding: false,
     body: ...)
  1. 将您的内容FilstList(searchtext: _text,)放入scrollableView(如SingleChildScrollViewListView
2020-08-13