一开始直接使用Scaffold布局,body:new Column  然后模拟器会提示捕获异常:

 然后百度了一下Flutter的溢出问题,发现解决办法是使用SingleChildScrollView包装一下。

比如原来代码是:

return Scaffold(
     appBar: AppBar(
           title: Text('组件案例'),
     ),
     body: new Column(
        children: <Widget>[
          ....
        ],
     )
);

改为:

  return Scaffold(
      appBar: AppBar(
         title: Text('组件案例'),
      ),
      body: SingleChildScrollView(
         child: ConstrainedBox(
            constraints: BoxConstraints(minHeight: 120.0),
            child: new Column(
               children: <Widget>[
                  ...
               ]
            ),
         ),
      ),  
  ); 

 

转载于:https://www.cnblogs.com/joe235/p/11198910.html

Logo

开源鸿蒙跨平台开发社区汇聚开发者与厂商,共建“一次开发,多端部署”的开源生态,致力于降低跨端开发门槛,推动万物智联创新。

更多推荐