childCrossAxisPosition method
- @override
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) {
assert(child != null);
assert(child == this.child);
assert(constraints != null);
assert(constraints.axisDirection != null);
assert(constraints.growthDirection != null);
assert(_resolvedPadding != null);
switch (applyGrowthDirectionToAxisDirection(constraints.axisDirection, constraints.growthDirection)) {
case AxisDirection.up:
case AxisDirection.down:
return _resolvedPadding.left;
case AxisDirection.left:
case AxisDirection.right:
return _resolvedPadding.top;
}
return null;
}