Flutter - ListView.builder with very large size and does not change

To work with the correct size simply change the value itemExtent: 128.0 to a smaller number such asitemExtent: 46.0

That defines the size of each child, you can remove it and the builder will calculate the size for each item based on its dimensions. Removing itemExtent to be automatically calculate.

The ListView also needs a key, because when updating to another list, if each list does not have its own key the list is mounted in the wrong way.

The ListView code should look like this:

body: new ListView.builder(
  key: new Key(randomString(20)), //new
  itemBuilder: (BuildContext context, int index) => children[index],
  //itemExtent: 128.0,
  itemCount: children.length,
),

By making this change the list is mounted correctly.

Tags:

Dart

Flutter