Advertisement

Flutter 中的 Positioned、Align 和 Center 在 Flutter Widgets 中的使用方法解析

阅读量:

组合属性分析

  • 左上角、右上角、左下角、右下角

BgContainer(
child: Stack(
alignment: Alignment.center,
// 设定填充模式以适应父级约束的最大尺寸
fit: StackFit.expand,
children: [
Positioned(
top: 10,
left: 10,
child: getItem(‘左上角’),
),
Positioned(
top: 10,
right: 10,
child: getItem(‘右上角’),
),
Positioned(
bottom: 10,
left: 10,
child: getItem(‘左下角’),
),
Positioned(
bottom: 10,
right: 10,
child: getItem(‘右下角’),
),
],
),
)

image.png
  • 若同时运用 leftright 参数会呈现何种效果?

BgContainer

全部评论 (0)

还没有任何评论哟~