账号密码登录
微信安全登录
微信扫描二维码登录

登录后绑定QQ、微信即可实现信息互通

手机验证码登录
找回密码返回
邮箱找回 手机找回
注册账号返回
其他登录方式
分享
  • 收藏
    X
    Flutter Container 尺寸变化问题
    60
    0

    官网提到

    Containers with no children try to be as big as possible unless the incoming constraints are unbounded, in which case they try to be as small as possible.

    意思是如果没有子元素, 并且给的constraintsunbounded的, 那么Container就会尽可能的小.

    但是测试下来似乎不是这样的, 不知道是不是理解有误

    body: Container(
        color: Colors.blueAccent,
        constraints: BoxConstraints(maxHeight: double.infinity, maxWidth: double.infinity),
        child: Container(
            color: Colors.redAccent,
        ),
    ),

    上面是代码, 蓝色Container里面套了一层红色Container. 外层Container给了unbounded的constraints, 但是内层的Container任然是铺满了外层的Container.

    这个是为什么? 或者说, BoxConstraints(maxHeight: double.infinity, maxWidth: double.infinity),并不是unbounded的?

    0
    打赏
    收藏
    点击回答
    您的回答被采纳后将获得:提问者悬赏的 11 元积分
        全部回答
    • 0
    • ㄊが亻 普通会员 1楼
      502 Bad Gateway

      502 Bad Gateway


      nginx
    更多回答
    扫一扫访问手机版
    • 回到顶部
    • 回到顶部