Flutter widget始终保持在屏幕底部

2021-06-07  本文已影响0人  赵哥窟
截屏2021-06-07 10.05.35.png

这样的布局,确认支付要在屏幕的最底部,只需要Stack+Positioned 这种方式也可以实现。

Widget _bodyWidget(ConfirmPaymentState state, Dispatch dispatch, ViewService viewService) {
  return Scaffold(
    backgroundColor: Global.pageBackgroundColor,
    appBar: AppBar(
      elevation: 0, //去掉Appbar底部阴影
      title: Text("确认支付"),
      backgroundColor:Global.pageBackgroundColor,
      centerTitle: true,
    ),
    body: Stack(
      children: [
        ListView(
          children: [
                //头部代码省略
          ],
        ),
        Positioned(
          left: 0,
          right: 0,
          bottom:0,
          child: _bottomWidget(),
        ),

      ],
    ),
  );
}
上一篇 下一篇

猜你喜欢

热点阅读