scrollOffsetOf method Null safety
- RenderSliver child,
- double scrollOffsetWithinChild
override
Returns the scroll offset within the viewport for the given
scrollOffsetWithinChild
within the given child
.
The returned value is an estimate that assumes the slivers within the viewport do not change the layout extent in response to changes in their scroll offset.
Implementation
@override
double scrollOffsetOf(RenderSliver child, double scrollOffsetWithinChild) {
assert(child.parent == this);
assert(child.constraints.growthDirection == GrowthDirection.forward);
double scrollOffsetToChild = 0.0;
RenderSliver? current = firstChild;
while (current != child) {
scrollOffsetToChild += current!.geometry!.scrollExtent;
current = childAfter(current);
}
return scrollOffsetToChild + scrollOffsetWithinChild;
}