我通过包装面临的一个问题TextField用new Expanded()。当尝试搜索textfield其内容时,显示出底部溢出30px。下面是我的代码:
TextField
new 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,) ), ], ), ); } }
有 两个 解决方案。
resizeToAvoidBottomPadding: false
Scaffold
Scaffold( resizeToAvoidBottomPadding: false, body: ...)
FilstList(searchtext: _text,)
scrollableView
SingleChildScrollView
ListView