I'am trying to add TextField to a Dialog, but when the Keyboard appears, it gives an overflow.
My dialog Image
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,
)
The solution to resolve this overflow error is to make your entire widget or in our case the Column scrollable. We can do that by wrapping our Column inside a SingleChildScrollView. Also, wrap the SingleChildScrollView with Center so that the entire UI is centered.
Step 1: Open the page where you have the TextField widget. Step 2: Locate the Scaffold widget. Step 3: Inside the Scaffold widget, add the resizeToAvoidBottomInset property and set its value to false . Step 4: Re-run the app.
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,
),
]
)
)
)
The problem is on the screen behind the Dialog. I faced the same problem but no one of the solutions above worked with my code so I used this code:
resizeToAvoidBottomInset: false,
This line be under "return Scaffold" I found this solution on this page
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With