MultiSliver calculates an invalid SliverGeometry when the incoming SliverConstraints.remainingCacheExtent is infinity. Infinity should be accepted: according to the docs, remainingPaintExtent can be infinity and remainingCacheExtent is always >= remainingPaintExtent. One situation in which this occurs is a shrinkwrapped CustomScrollView unconstrained on its main axis.
Specifically, RenderMultiSliver sets its SliverGeometry.cacheExtent to NaN, by subtracting infinity from infinity in this calculation in RenderMultiSliver._layoutChildSequence. This causes a series of assertion failures and incomplete rendering.
I suspect the code should instead accumulate the cacheExtent of the children to determine its own cacheExtent, as it does for the paintExtent already.
This app reproduces the problem for me, using sliver_tools 0.2.12:
Thanks for creating the issue and already doing some research for me!
I’ll see if I can make some time in the near future to take a closer look.
A PR would also be welcome
MultiSliver calculates an invalid
SliverGeometry
when the incomingSliverConstraints.remainingCacheExtent
is infinity. Infinity should be accepted: according to the docs,remainingPaintExtent
can be infinity andremainingCacheExtent
is always>= remainingPaintExtent
. One situation in which this occurs is a shrinkwrappedCustomScrollView
unconstrained on its main axis.Specifically,
RenderMultiSliver
sets itsSliverGeometry.cacheExtent
toNaN
, by subtracting infinity from infinity in this calculation in RenderMultiSliver._layoutChildSequence. This causes a series of assertion failures and incomplete rendering.I suspect the code should instead accumulate the
cacheExtent
of the children to determine its owncacheExtent
, as it does for thepaintExtent
already.This app reproduces the problem for me, using
sliver_tools 0.2.12
: