Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter TextFormField hidden by keyboard

People also ask

How do you fix a keyboard overflow Flutter?

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.


thanks solve my problem with this padding on bottom of textfield

    Padding(
             padding: EdgeInsets.only(
             bottom: MediaQuery.of(context).viewInsets.bottom));

and mare reverse list


This worked for me...

First add this

final bottom = MediaQuery.of(context).viewInsets.bottom;

Then use a SingleChildScrollView() to wrap around the main widget (whatever you're using, e.g. Column, ListView, etc) like this...

You need "reverse: true"

Widget build{
return Scaffold(
body: SingleChildScrollView(
reverse: true;
child: Container(...

You also need these two lines of code for the Scaffold as well..

return Scaffold(
resizeToAvoidBottomInset: false,
resizeToAvoidBottomPadding: false,
body: SingleChildScrollView(...

and finally, reference the 'bottom' for your EdgeInsets..

body: SingleChildScrollView(
reverse: true,
child: Padding(
padding: EdgeInsets.only(bottom: bottom),
child: Container(...

You need to wrap everything in a SingleChildScrollView and set the reverse to true.

SingleChildScrollView(
   reverse: true,
   child: Container(),
);

Just that worked for me!


There are few methods for this (as of Dec 3rd 2018):

You can read this for a better solution: When i select a Textfield the keyboard moves over it.

Inside Scaffold() add: resizeToAvoidBottomPadding: false,.

You can also wrap your TextWidget with SingleChildScrollView(). This will allow you to scroll whenever the keyboard is shown.


I had a similar problem. I try all solution, but didn't work. Finally I removed

<item name="android:windowFullscreen">true</item>

from my styles.xml file in android folder, and fix the problem.


Too add to the commonly accepted answers here which is

body: SingleChildScrollView(
          reverse: true,
          child: Container(
              child: Padding(
            padding: EdgeInsets.only(bottom: bottom),
            child: Stack(
              fit: StackFit.loose,
              children: <Widget>[

I added a thing to the bottom inset to prevent it from going too high.

    var bottom = MediaQuery.of(context).viewInsets.bottom;
bottom = max(min(bottom, 80), 0);