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

查看:245
本文介绍了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天全站免登陆