LayoutBuilder class

官方文档LayoutBuilder class

LayoutBuilder class

Builds a widget tree that can depend on the parent widget’s size.

构建依赖于父控件大小的控件树

Similar to the Builder widget except that the framework calls the builder function at layout time and provides the parent widget’s constraints. This is useful when the parent constrains the child’s size and doesn’t depend on the child’s intrinsic size. The LayoutBuilder’s final size will match its child’s size.

与创建控件相似,除了框架在布局时候调用builder并提供父控件的约束信息。适合需要父控件约束子控件大小,而不是依赖子控件的内在大小的时候使用。最终LayoutBuilder的大小会匹配它的子控件大小。

If the child should be smaller than the parent, consider wrapping the child in an Align widget. If the child might want to be bigger, consider wrapping it in a SingleChildScrollView.

如果子控件需要小于父控件,可以考虑将子控件放在带有排序功能的控件中。如果子控件想要变得更大,可以考虑放在SingleChildScrollView中。

See also:

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值