Search code examples
flutteroverflowtextfield

TextField bottom overflowed when focused


I have TextField in Flutter. It is located at the bottom of the screen, example: enter image description here

I placed few Texts before to move it to the bottom, for this example. When I focus TextField, overflowed area appears:

enter image description here

How to get rid of this area? One option would be to display keyboard (without overflowed area) or second to display "white screen" with text field like we are used in Android (in landscape, when there is not much place).

Can somebody advise, how to get rid of this faulty behaviour? Thank you.

My code:

return Scaffold(
  key: scaffoldKey,
  body: SafeArea(
    child: Column(
      children: [
        Text("Test"),
        ...
        TextField()
      ],
    ),
  )
);

Solution

  • Wrap your Column widget inside the ListView or SingleChildScrollView to make it scrollable when keyboard open :

    return Scaffold(
            key: scaffoldKey,
            body: SafeArea(
              child: ListView(
                padding:EdgeInsets.zero,
                children: [
                  Column(
                    children: [
                      Text("Test"),
                      ...
                      TextField()
                    ],
                  ),
                ],
              ),
            )
        );;