美文网首页flutter
Flutter之FractionallySizedBox组件

Flutter之FractionallySizedBox组件

作者: 习惯了_就好 | 来源:发表于2019-03-26 15:13 被阅读1次
    /**
     * 百分比布局,SizeBox直接通过width,height限制子控件;FractionallySizedBox通过百分比限制
     * const FractionallySizedBox({
        Key key,
        this.alignment = Alignment.center,
        this.widthFactor,//宽度因子,乘以宽度就是组件最后的宽
        this.heightFactor,
        Widget child,
        })
     */
    
    body: Container(
                width: 100.0,
                height: 100.0,
                color: Colors.blue,
                child: FractionallySizedBox(
                  widthFactor: 0.5,
                  heightFactor: 1.5,
                  child: Container(
                    width: 100.0,
                    height: 100.0,
                    color: Colors.red,
                  ),
                ),
              )
    

    相关文章

      网友评论

        本文标题:Flutter之FractionallySizedBox组件

        本文链接:https://www.haomeiwen.com/subject/btngvqtx.html