maxScrollObstructionExtentBefore method

  1. @override
double maxScrollObstructionExtentBefore(
  1. RenderSliver child
)
override

Returns the total scroll obstruction extent of all slivers in the viewport before child.

This is the extent by which the actual area in which content can scroll is reduced. For example, an app bar that is pinned at the top will reduce the area in which content can actually scroll by the height of the app bar.

Implementation

@override
double maxScrollObstructionExtentBefore(RenderSliver child) {
  assert(child.parent == this);
  assert(child.constraints.growthDirection == GrowthDirection.forward);
  double pinnedExtent = 0.0;
  RenderSliver? current = firstChild;
  while (current != child) {
    pinnedExtent += current!.geometry!.maxScrollObstructionExtent;
    current = childAfter(current);
  }
  return pinnedExtent;
}