构造函数
Flex({
Key key,
@required this.direction, // 轴向
this.mainAxisAlignment = MainAxisAlignment.start, // 主轴方向对齐方式
this.mainAxisSize = MainAxisSize.max, // 主轴尺寸
this.crossAxisAlignment = CrossAxisAlignment.center, // 交叉轴方向对齐方式
this.textDirection,
this.verticalDirection = VerticalDirection.down, // 垂直排序
this.textBaseline,
List<Widget> children = const <Widget>[],
})
DEMO
截屏2020-05-13 上午8.48.59.png
Flex(
mainAxisAlignment: MainAxisAlignment.center,
direction: Axis.horizontal,
children: <Widget>[
Container(
width: 100,
height: 50,
color: Colors.yellow,
),
Container(
width: 50,
height: 100,
color: Colors.green,
),
Container(
width: 100,
height: 50,
color: Colors.red,
)
],
);
网友评论