Imaxd
Imaxd

Reputation: 366

flutter: EXCEPTION CAUGHT BY RENDERING LIBRARY: A RenderFlex overflowed by n pixels on the bottom

When deploying the onscreen keyboard on android, flutter throws an exception and renders a yellow and black striped pattern. The exception message explains why and how to avoid this but I fail to understand why is this an error condition in the first place. Can I just ignore it and if not how to properly handle it.

bottom overflowed by 128 pixels

Upvotes: 3

Views: 1582

Answers (1)

timilehinjegede
timilehinjegede

Reputation: 14033

  1. A quick solution would be to block the widgets inside the Scaffold to resize themselves when the keyboard opens. We can do this using the resizeToAvoidBottomInset property on the Scaffold widget.
     Scaffold(
        resizeToAvoidBottomInset: false,
        body: .....,
      ),

OR

  1. Another solution is to wrap the Column widget into a scrollable widget. A built-in widget provided by Flutter which works well is the SingleChildScrollView. This is the best solution to avoid the Bottom overflowed error when the keyboard opens.

Upvotes: 4

Related Questions