Blog

[Flutter] Why ListView and Similar Widgets Don't Show Up

Published 1 min read

Understanding constraints

When you try to put a ListView inside a widget like Column or Row,
widgets like ListView try to grow infinitely, but
widgets like Column and Row apparently don't put a size limit on them.
That's because putting a size limit would actually take away the space for other widgets.

So you have to set the ListView's height explicitly.
The most common way to set the height is to wrap it in an Expanded widget.
The Expanded widget takes up all the remaining space except for widgets whose size or position is fixed, so
you can think of it as telling the ListView that it uses all the remaining space of the widget whose height is already set.

Comments

Leaving a comment stores your nickname (or GitHub profile info). Privacy policy

GitHub