Flutter TextFormField hidden by keyboard

后端 未结 7 1482
暖寄归人
暖寄归人 2020-11-29 03:22

NOTE: Im using Navigator.of(context).push to push ModalRoute,

Hi I have page with ModalRoute with TextFormField in the bod

相关标签:
7条回答
  • 2020-11-29 04:00

    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

    0 讨论(0)
  • 2020-11-29 04:02

    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.

    0 讨论(0)
  • 2020-11-29 04:06

    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(...
    
    0 讨论(0)
  • 2020-11-29 04:08

    I use form elements in modal_bottom_sheet plugin. I solved it by just adding the following code to SingleChildScrollView.

    padding: EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom)
    
    0 讨论(0)
  • 2020-11-29 04:09

    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.

    0 讨论(0)
  • 2020-11-29 04:10

    Set resizeToAvoidBottomInset to false inside your Scaffold Widget.

    Note that resizeToAvoidBottomPadding will be deprecated.

    Scaffold( resizeToAvoidBottomInset: false, ...)
    
    0 讨论(0)
提交回复
热议问题