skip to Main Content

I was having bottom overflow issue (this is so funny) when keyboard is shown, so I set my scaffold resizeToAvoidBottomInset property to false as suggested in a few SO posts.

Doing this fixes the overflow issue but has an unintended consequence where snackbar appears below the keyboard and is thus invisible.

Setting resizeToAvoidBottomInset to true solves the snackbar issue, but the bottom overflow is back!

How can I have my cake and eat it too?

2

Answers


  1. You can wrap your main content in a SingleChildScrollView to avoid to bottom overflow issue when the keyboard appears.

    Login or Signup to reply.
  2. Use a SingleChildScrollView around your widget, keep resizeToAvoidBottomInset: true

    SingleChildScrollView(
        // Make sure the SingleChildScrollView has a padding at the bottom equal to the keyboard height
        padding: EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom)
        child: ...
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search