itemExtentBuilder property
If non-null, forces the children to have the corresponding extent returned by the builder.
Specifying an itemExtentBuilder
is more efficient than letting the children
determine their own extent because the scrolling machinery can make use of
the foreknowledge of the children's extent to save work, for example when
the scroll position changes drastically.
This will be called multiple times during the layout phase of a frame to find the items that should be loaded by the lazy loading process.
Should return null if asked to build an item extent with a greater index than exists.
Unlike itemExtent
or prototypeItem
, this allows children to have
different extents.
See also:
- SliverVariedExtentList, the sliver used internally when this property is provided. It constrains its box children to have a specific given extent along the main axis.
- The
itemExtent
property, which allows forcing the children's extent to a given value. - The
prototypeItem
property, which allows forcing the children's extent to be the same as the given widget.
Implementation
final ItemExtentBuilder? itemExtentBuilder;