setChildParentData method

  1. @protected
void setChildParentData(
  1. RenderObject child,
  2. SliverConstraints constraints,
  3. SliverGeometry geometry
)

Sets the SliverPhysicalParentData.paintOffset for the given child according to the SliverConstraints.axisDirection and SliverConstraints.growthDirection and the given geometry.

Implementation

@protected
void setChildParentData(RenderObject child, SliverConstraints constraints, SliverGeometry geometry) {
  final SliverPhysicalParentData childParentData = child.parentData! as SliverPhysicalParentData;
  childParentData.paintOffset = switch (applyGrowthDirectionToAxisDirection(constraints.axisDirection, constraints.growthDirection)) {
    AxisDirection.up    => Offset(0.0, geometry.paintExtent + constraints.scrollOffset - geometry.scrollExtent),
    AxisDirection.left  => Offset(geometry.paintExtent + constraints.scrollOffset - geometry.scrollExtent, 0.0),
    AxisDirection.right => Offset(-constraints.scrollOffset, 0.0),
    AxisDirection.down  => Offset(0.0, -constraints.scrollOffset),
  };
}