|
|
|
|
|
|
GrowthDirectionUtils.applyGrowthDirectionToScrollDirection( |
|
|
|
this.offset.userScrollDirection, growthDirection); |
|
|
|
float maxPaintOffset = layoutOffset + overlap; |
|
|
|
float precedingScrollExtent = 0.0f; |
|
|
|
|
|
|
|
while (child != null) { |
|
|
|
float sliverScrollOffset = scrollOffset <= 0.0 ? 0.0f : scrollOffset; |
|
|
|
|
|
|
growthDirection: growthDirection, |
|
|
|
userScrollDirection: adjustedUserScrollDirection, |
|
|
|
scrollOffset: sliverScrollOffset, |
|
|
|
precedingScrollExtent: precedingScrollExtent, |
|
|
|
overlap: maxPaintOffset - layoutOffset, |
|
|
|
remainingPaintExtent: Mathf.Max(0.0f, |
|
|
|
remainingPaintExtent - layoutOffset + initialLayoutOffset), |
|
|
|
|
|
|
maxPaintOffset = Mathf.Max(effectiveLayoutOffset + childLayoutGeometry.paintExtent, |
|
|
|
maxPaintOffset); |
|
|
|
scrollOffset -= childLayoutGeometry.scrollExtent; |
|
|
|
precedingScrollExtent += childLayoutGeometry.scrollExtent; |
|
|
|
layoutOffset += childLayoutGeometry.layoutExtent; |
|
|
|
|
|
|
|
if (childLayoutGeometry.cacheExtent != 0.0) { |
|
|
|
|
|
|
public RevealedOffset getOffsetToReveal(RenderObject target, float alignment, Rect rect = null) { |
|
|
|
float leadingScrollOffset = 0.0f; |
|
|
|
float targetMainAxisExtent = 0.0f; |
|
|
|
RenderObject descendant; |
|
|
|
if (target is RenderBox) { |
|
|
|
RenderBox targetBox = (RenderBox) target; |
|
|
|
RenderObject child = target; |
|
|
|
RenderBox pivot = null; |
|
|
|
bool onlySlivers = target is RenderSliver; |
|
|
|
while (child.parent != this) { |
|
|
|
D.assert(child.parent != null, $"target must be a descendant of ${this}"); |
|
|
|
if (child is RenderBox) { |
|
|
|
pivot = (RenderBox) child; |
|
|
|
} |
|
|
|
RenderBox pivot = targetBox; |
|
|
|
while (pivot.parent is RenderBox) { |
|
|
|
pivot = (RenderBox) pivot.parent; |
|
|
|
if (child.parent is RenderSliver) { |
|
|
|
RenderSliver parent = (RenderSliver) child.parent; |
|
|
|
leadingScrollOffset += parent.childScrollOffset(child); |
|
|
|
else { |
|
|
|
onlySlivers = false; |
|
|
|
leadingScrollOffset = 0.0f; |
|
|
|
} |
|
|
|
|
|
|
|
child = (RenderObject) child.parent; |
|
|
|
} |
|
|
|
if (pivot != null) { |
|
|
|
D.assert(pivot.parent != null); |
|
|
|
D.assert(pivot.parent != this); |
|
|
|
D.assert(pivot != this); |
|
|
|
|
|
|
|
|
|
|
transform = targetBox.getTransformTo(pivot); |
|
|
|
transform = target.getTransformTo(pivot); |
|
|
|
Rect bounds = transform.mapRect(rect); |
|
|
|
|
|
|
|
float offset = 0.0f; |
|
|
|
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
leadingScrollOffset = pivot.size.height - offset; |
|
|
|
leadingScrollOffset += pivot.size.height - offset; |
|
|
|
leadingScrollOffset = bounds.left; |
|
|
|
leadingScrollOffset += bounds.left; |
|
|
|
leadingScrollOffset = bounds.top; |
|
|
|
leadingScrollOffset += bounds.top; |
|
|
|
targetMainAxisExtent = bounds.height; |
|
|
|
break; |
|
|
|
case AxisDirection.left: |
|
|
|
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
leadingScrollOffset = pivot.size.width - offset; |
|
|
|
leadingScrollOffset += pivot.size.width - offset; |
|
|
|
|
|
|
|
descendant = pivot; |
|
|
|
else if (target is RenderSliver) { |
|
|
|
else if (onlySlivers) { |
|
|
|
leadingScrollOffset = 0.0f; |
|
|
|
descendant = targetSliver; |
|
|
|
} |
|
|
|
|
|
|
|
RenderObject child = descendant; |
|
|
|
while (child.parent is RenderSliver) { |
|
|
|
var parent = (RenderSliver) child.parent; |
|
|
|
leadingScrollOffset += parent.childScrollOffset(child); |
|
|
|
child = parent; |
|
|
|
} |
|
|
|
|
|
|
|
D.assert(child.parent == this); |
|
|
|