flutter

Flutter handle ListView overflow in Column

Everytime I run into this ... literally everytime: ListView in a Column and the resulting overflows (ok, to be honest, there's some not underestimating time between the usages ;)). "A RenderFlex overflowed by xxx pixels on the bottom" looks familiar? Ok solution is sometimes really simple: Just wrap your ListView in an Expanded widget before adding it to the Column. In most cases this works pretty well.

Reason for this is, that Expanded forces the child to expand to the max size in the Column thus it prevents from sudden overflow.

 Column(
    children: <Widget>[
      Expanded(
        child: ListView(
          children: <Widget>[
            ...
          ],
        ),
      )
    ],
 )