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),),
                  ),
                 
 
 
                ],
              ),
            ),
          ),
 
    );


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM