/**
* 百分比布局,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,
),
),
)
网友评论