computeAbsolutePaintOffset method

  1. @protected
Offset computeAbsolutePaintOffset (
  1. RenderSliver child,
  2. double layoutOffset,
  3. GrowthDirection growthDirection
)
@protected

The offset at which the given child should be painted.

The returned offset is from the top left corner of the inside of the viewport to the top left corner of the paint coordinate system of the child.

See also paintOffsetOf, which uses the layout offset and growth direction computed for the child during layout.

Implementation

@protected
Offset computeAbsolutePaintOffset(RenderSliver child, double layoutOffset, GrowthDirection growthDirection) {
  assert(hasSize); // this is only usable once we have a size
  assert(axisDirection != null);
  assert(growthDirection != null);
  assert(child != null);
  assert(child.geometry != null);
  switch (applyGrowthDirectionToAxisDirection(axisDirection, growthDirection)) {
    case AxisDirection.up:
      return Offset(0.0, size.height - (layoutOffset + child.geometry.paintExtent));
    case AxisDirection.right:
      return Offset(layoutOffset, 0.0);
    case AxisDirection.down:
      return Offset(0.0, layoutOffset);
    case AxisDirection.left:
      return Offset(size.width - (layoutOffset + child.geometry.paintExtent), 0.0);
  }
  return null;
}