Flutter之BottomSheet组件

/**
    const BottomSheet({
    Key key,
    this.animationController,
    this.enableDrag = true,
    this.elevation = 0.0,
    @required this.onClosing,
    @required this.builder
    })
 */
floatingActionButton: Builder(builder: (BuildContext context) {
  return FloatingActionButton(
    onPressed: () =>
        Scaffold
            .of(context)
            .showBottomSheet<Null>(
                (BuildContext context) {
              return Container(
                height: 300.0,
                color: Color(0xffff0000),
              );
            })

        //closed:当此对象控制的元素不可见时完成
        // whenComplete:完成时调用的函数
            .closed
            .then((value) => print(value))
            .whenComplete(() {
          // mounted:bool值,这个State对象当前是否在结构树中
          if (!mounted) {
            print("已经不在结构树中了");
          } else {
            print("在结构树中");
          }
        }),
    child: Text("click"),
  );
})

码云地址:https://gitee.com/xgljh/Flutter.git

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容