美文网首页
showModalBottomSheet的状态

showModalBottomSheet的状态

作者: 我一不小心就 | 来源:发表于2021-05-10 14:58 被阅读0次
    // 返回一个controller
      Future<int> _showBottomSheet(BuildContext context){
          return showModalBottomSheet<int>(
            // 1.设置圆角
            shape: RoundedRectangleBorder(
              borderRadius: BorderRadius.only(topLeft: Radius.circular(ScreenUtil().setWidth(10)),
                                             topRight: Radius.circular(ScreenUtil().setWidth(10)))
            ),
            context: context,
                // 2.设置可以全屏
          //  isScrollControlled: true,
            builder: (BuildContext context){
                // 3.设置状态可以交互
                return StatefulBuilder(
                    builder: (BuildContext context, StateSetter setState){
                      return Container(
                        child: Stack(
                          children: [
                            Column(
                              children: [
                                Container(
                                  child: Text("购物篮"),
                                ),
                                Container(
                                  child: Text("列表页面"),
                                )
                              ],
                            ),
                            Positioned(
                              left: 0,
                              bottom: 0,
                              right: 0,
                              child: Container(
                                child: Text("aaaaaaa"),
                              ))
                          ],
                        ),
                      );
                    }
                );
            });
      }
    

    关于showBottomSheet的用法

    showBottomSheet(
                                      context: context,
                                      builder: (context) {
                                        return Container(
                                          decoration: BoxDecoration(
                                            color: Colors.lightBlue,
                                            borderRadius: BorderRadius.only(topLeft: Radius.circular(ScreenUtil().setWidth(10)),
                                                                            topRight: Radius.circular(ScreenUtil().setWidth(10)))
                                          ),
                                            height: ScreenUtil().setHeight(600),
                                        );
                                      });
    

    相关文章

      网友评论

          本文标题:showModalBottomSheet的状态

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