setChildParentData method

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

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;
  assert(constraints.axisDirection != null);
  assert(constraints.growthDirection != null);
  switch (applyGrowthDirectionToAxisDirection(constraints.axisDirection, constraints.growthDirection)) {
    case AxisDirection.up:
      childParentData.paintOffset = Offset(0.0, -(geometry.scrollExtent - (geometry.paintExtent + constraints.scrollOffset)));
      break;
    case AxisDirection.right:
      childParentData.paintOffset = Offset(-constraints.scrollOffset, 0.0);
      break;
    case AxisDirection.down:
      childParentData.paintOffset = Offset(0.0, -constraints.scrollOffset);
      break;
    case AxisDirection.left:
      childParentData.paintOffset = Offset(-(geometry.scrollExtent - (geometry.paintExtent + constraints.scrollOffset)), 0.0);
      break;
  }
  assert(childParentData.paintOffset != null);
}