且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Flutter:堆栈中的底部中心小部件

更新时间:2023-11-14 17:29:04

您可以在 Stack 内使用 Positioned.fill 和 Align:

You can use the Positioned.fill with Align inside a Stack:

Column(
  children: <Widget>[
    Stack(
      overflow: Overflow.visible,
      children: <Widget>[
        Container(
          width: MediaQuery.of(context).size.width,
          height: 170,
          decoration: BoxDecoration(
              color: Colors.white, borderRadius: BorderRadius.only(bottomLeft: Radius.circular(0), bottomRight: Radius.circular(0))),
          // child: Image.network(tutorImage),
        ),
        Positioned.fill(
          child: Align(
            alignment: Alignment.bottomCenter,
            child: Container(
              width: 60,
              height: 60,
              color: Colors.black,
            ),
          ),
        )
      ],
    ),
  ],
);