如何根据儿童内容包装高度以进行showmodalbottomsheet或删除自动高度

发布于 2025-01-24 19:38:36 字数 975 浏览 1 评论 0原文

我有一个底部表,在底部的纸上,我正在管理路由 我的每个屏幕都有不同的屏幕尺寸。我想更改每个屏幕的showmodalbottomsheet的高度。

showModalBottomSheet<void>(
      context: context,
      isDismissible: true,
      //isScrollControlled: true,
      elevation: 2.0,
      barrierColor: Colors.white.withOpacity(0),
      builder: (BuildContext context) {
        // double ht = Provider.of<SearchByLocationNotify>(context).getScreenSize;
        return SizedBox(
            height: MediaQuery.of(context).size.height * 0.5,// currently static height provided
            child: PopUpHome());
      },
    );
  1. 根据每个屏幕更改高度
  2. 或包裹孩子的内容,以便不需要静态高度

“在此处输入图像说明”

在上面的图像中,红色porion是show> showmodalbottomsheet blue blue是我的孩子,所以我想要红色部分只能占据蓝色。

I have one bottom sheet and under that bottom sheet i am managing routing
my each screen have different screen size. and i want to change the height of showModalBottomSheet for each screen.

showModalBottomSheet<void>(
      context: context,
      isDismissible: true,
      //isScrollControlled: true,
      elevation: 2.0,
      barrierColor: Colors.white.withOpacity(0),
      builder: (BuildContext context) {
        // double ht = Provider.of<SearchByLocationNotify>(context).getScreenSize;
        return SizedBox(
            height: MediaQuery.of(context).size.height * 0.5,// currently static height provided
            child: PopUpHome());
      },
    );
  1. change the height according to each screen
  2. or wrap the content of children so that static height is not needed

enter image description here

In the above image red porion is showModalBottomSheet blue is my child so i want red portion should only occupy blue.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

拍不死你 2025-01-31 19:38:36

返回Mainaxissize的列:Mainaxissize.min从构建器返回,并将您的内容放在列窗口小部件中。

return a Column with mainAxisSize: MainAxisSize.min from the builder and place your content inside the Column widget.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文