# childCrossAxisPosition method

- covariant RenderSliver child

override

Returns the distance along the cross axis from the zero of the cross axis in this sliver's paint coordinate space to the nearest side of the given child.

For example, if the constraints describe this sliver as having an axis direction of AxisDirection.down, then this is the distance from the left of the sliver to the left of the child. Similarly, if the constraints describe this sliver as having an axis direction of AxisDirection.up, then this is value is the same. If the axis direction is AxisDirection.left or AxisDirection.right, then it is the distance from the top of the sliver to the top of the child.

Calling this for a child that is not visible is not valid.

## Implementation

```
@override
double childCrossAxisPosition(RenderSliver child) {
final Offset paintOffset = (child.parentData! as SliverPhysicalParentData).paintOffset;
return switch (constraints.axis) {
Axis.vertical => paintOffset.dx,
Axis.horizontal => paintOffset.dy,
};
}
```