Flutter教学

Flutter(54):Layout组件之LimitedBox

2020-10-16  本文已影响0人  starryxp

Flutter教学目录持续更新中

Github源代码持续更新中

1.LimitedBox介绍

一个当其自身不受约束时才限制其大小的盒子

2.LimitedBox属性

3. LimitedBox

这里有几个注意点:

image.png
      body: Container(
        color: Colors.blue,
        child: UnconstrainedBox(
          child: LimitedBox(
            maxWidth: 100,
            maxHeight: 100,
            child: Text(
                'ddaaddaaddaaddaaddaaddaaddaaddaaddaaddaaddaaddaaddaaddaaddaaddaaddaaddaaddaaddaa'),
          ),
        ),
      ),

这里使用UnconstrainedBox就是为了让LimitedBox不受到约束限制,如果LimitedBox受到约束限制的话是不起作用的。

下一节:Layout组件之Offstage

Flutter(55):Layout组件之Offstage

Flutter教学目录持续更新中

Github源代码持续更新中

上一篇 下一篇

猜你喜欢

热点阅读