flutter 只用Positioned,让一个控件叠在另外一个控件的底部居中

方法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,
        ),
      ),
    )
  ],
)

你可能感兴趣的:(flutter,flutter,前端,javascript)