ConstrainedBox class

官方文档ConstrainedBox class

ConstrainedBox class

A widget that imposes additional constraints on its child.

ConstrainedBox 可以为它的子控件强制加上一个约束条件。

For example, if you wanted child to have a minimum height of 50.0 logical pixels, you could use const BoxConstraints(minHeight: 50.0) as the constraints.

比如你希望子控件拥有最小50像素的高度,你就可以使用const BoxConstraints(minHeight: 50.0)

Sample

This snippet makes the child widget (a Card with some Text) fill the parent, by applying BoxConstraints.expand constraints:

ConstrainedBox(
  constraints: const BoxConstraints.expand(),
  child: const Card(child: Text('Hello World!')),
)

The same behavior can be obtained using the new SizedBox.expand widget.

See also:

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值