Flutter防止布局溢出

添加一层可滑动View(Widget)的布局, 将之前进行包裹:

return new Scaffold(
      appBar: new AppBar(
        title: new Text("搜索"),
      ),
      //使用ScrollView包装一下,否则键盘弹出时会报错空间溢出
      body: new SingleChildScrollView(
            child: new ConstrainedBox(
              constraints: new BoxConstraints(
                minHeight: 120.0,
              ),
              child: new Column(
                mainAxisSize: MainAxisSize.min,
                mainAxisAlignment: MainAxisAlignment.spaceAround,
                children: <Widget>[
                  new Padding(
                    padding: EdgeInsets.fromLTRB(0.0, 40.0, 0.0, 10.0),
                    child:new Text("注意",style: new TextStyle(fontSize: 18.0,color: Colors.orangeAccent),),
                  ),
                 
 
 
                ],
              ),
            ),
          ),
 
    );

猜你喜欢

转载自www.cnblogs.com/gloryhope/p/11307084.html