在较小的设备上的扑面而出溢出底部问题

发布于 2025-01-19 12:30:23 字数 1272 浏览 2 评论 0原文

我的应用程序中有一个警报对话框,它来自 init 元素。该表单由一个列小部件包裹。然而,当键盘打开时,它会引发底部溢出问题。为了解决这个问题,我使用 singlechildScrollview 包装了该列。这解决了这个问题。但是当我在较小的设备中打开相同的内容时,即使使用 singlechildScrollview 包裹,它也会抛出底部溢出错误。目前,该问题存在于较小的设备上。下面给出了代码

Get.defaultDialog(
      title: 'Have any Issues?',
      titleStyle: Theme.of(Get.context!).textTheme.headline5,
      content: SafeArea(
        child: SingleChildScrollView(
          reverse: true,
          scrollDirection: Axis.vertical,
          physics: const ClampingScrollPhysics(),
          child: Column(
            children: [
              Padding(
                padding:  EdgeInsets.only(bottom:bottom),
                child: Text(
                  paymentIssueMessage,
                  textAlign: TextAlign.center,
                  style: Theme.of(context).textTheme.bodyText1,
                ),
              ),
              const SizedBox(
                height: 10,
              ),
              TextFormField(),
              TextFormField()    // Fields in form
              ]
             )
            )
           )

如何在较小屏幕设备上解决此问题?

输入图片此处描述

I have a alertdialog in my application which has come form elements init. The form is wrapped with a column widget. How ever when the keyboard opens up it throw bottom overflow issue. To solve that i have wrapped the column using singlechildScrollview. This solved the issue. But when i opened the same in a smaller device it throws the bottom overflow error even wrapped with singlechildScrollview. Currently the issue exists on smaller devices. The Code is given below

Get.defaultDialog(
      title: 'Have any Issues?',
      titleStyle: Theme.of(Get.context!).textTheme.headline5,
      content: SafeArea(
        child: SingleChildScrollView(
          reverse: true,
          scrollDirection: Axis.vertical,
          physics: const ClampingScrollPhysics(),
          child: Column(
            children: [
              Padding(
                padding:  EdgeInsets.only(bottom:bottom),
                child: Text(
                  paymentIssueMessage,
                  textAlign: TextAlign.center,
                  style: Theme.of(context).textTheme.bodyText1,
                ),
              ),
              const SizedBox(
                height: 10,
              ),
              TextFormField(),
              TextFormField()    // Fields in form
              ]
             )
            )
           )

How can I solve this issue on smaller screen devices??

enter image description here

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

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

发布评论

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

评论(1

剧终人散尽 2025-01-26 12:30:23

添加灵活的小部件或扩展的小部件,如下所示。

Column(
        children: [
          Padding(
            padding:  EdgeInsets.only(bottom:bottom),
            child: Text(
              paymentIssueMessage,
              textAlign: TextAlign.center,
              style: Theme.of(context).textTheme.bodyText1,
            ),
          ),
          const SizedBox(
            height: 10,
          ),
          TextFormField(),
          TextFormField()
        ].map((e) => Flexible(child: e)).toList(),
      )

Add a Flexible widget or Expanded widget like below.

Column(
        children: [
          Padding(
            padding:  EdgeInsets.only(bottom:bottom),
            child: Text(
              paymentIssueMessage,
              textAlign: TextAlign.center,
              style: Theme.of(context).textTheme.bodyText1,
            ),
          ),
          const SizedBox(
            height: 10,
          ),
          TextFormField(),
          TextFormField()
        ].map((e) => Flexible(child: e)).toList(),
      )
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文