Flutter:键盘溢出与我的对话框 [英] Flutter: Keyboard overflow with My Dialog

查看:18
本文介绍了Flutter:键盘溢出与我的对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将 TextField 添加到对话框中,但是当键盘出现时,它会溢出.

I'am trying to add TextField to a Dialog, but when the Keyboard appears, it gives an overflow.

我的对话图片

当键盘出现时

我的代码的一部分如下所示:

Here How a part my code looks Like:

AlertDialog(
    content: new ListView(
      shrinkWrap: true,
  children: <Widget>[
    Text(
      "How Would You Rate Our App?",
      style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold),
      textAlign: TextAlign.center,
    )

推荐答案

你可以简单地使用 SingleChildScrollView:

 AlertDialog(
        content: SingleChildScrollView(
          scrollDirection: Axis.vertical,
        child: Column(
          children: <Widget>[
            Text(
              "How Would You Rate Our App?",
              style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold),
              textAlign: TextAlign.center,
        ),
        ]
    )
    )
)

这篇关于Flutter:键盘溢出与我的对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆