Flutter之FractionallySizedBox组件
2019-03-26 本文已影响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,
),
),
)