我有Flutter(Dart)RenderFlex溢出像素的问题.渲染库的一个例外.
如何管理或应用滚动功能到我的应用页面视图,并避免Flutter使用以下消息呈现异常:
A RenderFlex overflowed by 28 pixels on the bottom.
如果你有任何机会需要完整的日志来帮助我在这里:
在热重载时,它根据消息在底部出现黄色/黑色条纹.
这是我可以使用可滚动小部件管理的东西吗?或者我可以声明我的小部件以控制它?
完整代码,如果需要(我更改了文本数据,但假设出现的文本长于屏幕大小,因此出现错误):
@override Widget build(BuildContext context) { return new DefaultTabController( length: 3,child: new Scaffold( appBar: new AppBar( bottom: new TabBar( tabs: [ new Tab(text: "xxx",),new Tab(text: "xxx",],title: new Text(data["xxx"]),body: new TabBarView( children: [ new Column( children: <Widget>[ new Text(data["xxx"],style: new TextStyle( fontStyle: FontStyle.italic,color: Colors.blue,fontSize: 16.0 ),new Text(data["xxx"],fontSize: 10.0 ),fontSize: 8.0 ),new Row( children: <Widget>[ new Expanded( child: new Text("xxx"),new Expanded( child: new Icon(Icons.file_download,color: Colors.green,size: 30.0,new Divider(),new Text("xxx",color: Colors.red,fontSize: 16.0 ),new ListView.builder( itemBuilder: (BuildContext context,int index) => new EntryItem(_lstTiles[index]),itemCount: _lstTiles.length,new Column( children: <Widget>[ new Text(data["xxx"],color: Colors.green[900],new Text(data["xxx"]),new ListTile(title: new Text("xxx")),); }
解决方法
这是一个非常常见的问题,尤其是当您开始在多个设备和方向上测试您的应用时. Flutter的Widget画廊有一个部分涵盖各种滚动小部件:
https://flutter.io/widgets/scrolling/
我建议将整个内容包装在SingleChildScrollView
中,或使用滚动ListView
.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。