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(
                (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

你可能感兴趣的:(Flutter之BottomSheet组件)