Search code examples
dartflutterflutter-layout

Flutter: Keyboard overflow with My Dialog


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

My dialog Image

dialog Image

When the Keyboard shows up

When the Keyboard shows up

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,
    )

Solution

  • You can simply use 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,
            ),
            ]
        )
        )
    )