Flutter使用可滚动组件(SingleChildScrollView,ListView,GridView)时的典型错误

在使用Flutter的SingleChildScrollView, ListView, GridView等可滚动组件时,遇到RenderFlex错误,原因是无限高度约束与非零flex冲突。解决方案是将mainAxisSize设为MainAxisSize.min,使用Flexible替代Expanded,并确保避免在Column内使用非零flex元素。" 119833467,7303234,RK3399平台Systemd系统启动解析,"['嵌入式开发', '系统启动', 'Linux', '设备管理', '服务配置']
摘要由CSDN通过智能技术生成

话不多说,直接丢报错信息,看看自己是否遇到:

The following assertion was thrown during performLayout():
RenderFlex children have non-zero flex but incoming height constraints are unbounded.
When a column is in a parent that does not provide a finite height constraint, for example if it is
in a vertical scrollable, it will try to shrink-wrap its children along the vertical axis. Setting a
flex on a child (e.g. using Expanded) indicates that the child is to expand to fill the remaining
space in the vertical direction.
These two directives are mutually exclusive. If a parent is to shrink-wrap its child, the child
cannot simultaneously expand to fit its parent.
Consider setting mainAxisSize to MainAxisSize.min and using FlexFit.loose fits for the flexible
children (using Flexible rather than Expanded). This will allow the flexible children to size
themselves to less than the infinite remaining space they would otherwise

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值