cacheOffset method
Computes the portion of the region from from
to to
that is within
the cache extent of the viewport.
This method is identical to RenderSliver.calculateCacheOffset.
Implementation
double cacheOffset(double from, double to) {
assert(from <= to);
final minOffset = scrollOffset + cacheOrigin;
final maxOffset = scrollOffset + remainingCacheExtent;
from = from.clamp(minOffset, maxOffset);
to = to.clamp(minOffset, maxOffset);
// the clamp on the next line is to avoid floating point rounding errors
return (to - from).clamp(0.0, remainingCacheExtent);
}