美文网首页flutter
Flutter之BottomSheet组件

Flutter之BottomSheet组件

作者: 习惯了_就好 | 来源:发表于2018-12-03 15:49 被阅读46次
/**
    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"),
  );
})

相关文章

网友评论

    本文标题:Flutter之BottomSheet组件

    本文链接:https://www.haomeiwen.com/subject/dlwycqtx.html