Flutter widget始终保持在屏幕底部

截屏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(),
        ),

      ],
    ),
  );
}
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容