方法1:可以用Stack的alignment:Alignment.center,
方法2:如下
Stack(
children: [
Container(
height: 300,
color: Colors.red,
),
Positioned(
bottom: 0,
left: 0,
right: 0,
child: Align(
alignment: Alignment.bottomCenter,
child: Container(
height: 50,
width: 100,
color: Colors.green,
),
),
)
],
)
好像下面是有效的
Stack(
children: [
Container(
height: 300,
color: Colors.red,
),
Positioned(
child: Align(
alignment: Alignment.center,
child: Container(
height: 50,
width: 100,
color: Colors.green,
),
),
)
],
)