Home > Software design >  Keyboard hide the textfield : SingleChildScrollView does not work
Keyboard hide the textfield : SingleChildScrollView does not work

Time:08-06

I am desperate to resolve this issue.

I made this simple page...

 return Scaffold(
      body:SingleChildScrollView(
        child:Column(children: [
          TextField(),
          TextField(),
          TextField(),
          SizedBox(height:200),
          TextField(),
          TextField(),
          TextField(),
        ],)
      )
    );

...and I tried all solutions from this post : Flutter TextFormField hidden by keyboard

Adding this property to my Scaffold :

resizeToAvoidBottomInset: false (or true)

Wrap the column with a bottom padding :

Padding(padding:EdgeInsets.only(bottom:MediaQuery.of(context).viewInsets.bottom), child:Column(),

Removing this line from styles.xml

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

Is there any angel who can help me ? Can the problem come from elsewhere like manifest... I was not having this issue before, now I have it on all my forms !

CodePudding user response:

Wrap the single child scroll view with a sized box of available height

return Scaffold(
  body: SizedBox(
   height: MediaQuery.of(context).size.height,
   width: MediaQuery.of(context).size.width,
   child: SingleChildScrollView (
    child : Column(
     children: []
   )
  )
 )
);

If this is being used in a bottom sheet add padding to the text field with bottom insets

CodePudding user response:

The issue was coming from my AndroidManifest.xml. These two lines were missing.

android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize"

I removed it previously myself because I had this warning : "Attribute hardwareAccelerated is only used in API level 11 and higher (current min is 1)"

  • Related