childMainAxisPosition method
- covariant RenderBox child
Returns the distance from the leading visible edge of the sliver to the side of the child closest to that edge, in the scroll axis direction.
For example, if the constraints describe this sliver as having an axis direction of AxisDirection.down, then this is the distance from the top of the visible portion of the sliver to the top of the child. If the child is scrolled partially off the top of the viewport, then this will be negative. On the other hand, if the constraints describe this sliver as having an axis direction of AxisDirection.up, then this is the distance from the bottom of the visible portion of the sliver to the bottom of the child. In both cases, this is the direction of increasing SliverConstraints.scrollOffset.
Calling this when the child is not visible is not valid.
The argument must be the value of the child
property.
This must be implemented by RenderSliverPersistentHeader subclasses.
If there is no child, this should return 0.0.
Implementation
@override
double childMainAxisPosition(RenderBox child) {
assert(child == this.child);
assert(_childPosition != null);
return _childPosition!;
}