Flutter之SizedBox组件

/**
 * 能强制子控件具有特定宽度、高度或两者都有,使子控件设置的宽高失效
 * const SizedBox({
 * Key key,
 * this.width,
 * this.height,
 * Widget child
 * })
 * */
body:SizedBox(
            width: 100.0,
            height: 100.0,
            child:  Container(
              width: 200.0,
              height: 200.0,
              color: Color(0xffff0000),
            ),
          )

猜你喜欢

转载自blog.csdn.net/weixin_34336526/article/details/86946947