axisStateY function
Computes the Y-axis state.
Implementation
AxisState axisStateY(
double signedAmount,
Rect currentRect,
Rect originRect,
Rect displayRect,
) {
final bound = boundForY(delta: signedAmount, currentRect: currentRect, baseRect: originRect);
final direction = directionStateForY(
delta: signedAmount,
currentRect: currentRect,
baseRect: originRect,
displayRect: displayRect,
);
final isBottom = bound == .bottom;
final pastDisplay = direction == .extendingPast || direction == .retractingPast;
final progress = pastDisplay
? ((isBottom
? currentRect.bottom - displayRect.bottom
: displayRect.top - currentRect.top) / displayRect.height).clamp(0.0, 1.0)
: ((currentRect.center.dy - originRect.center.dy).abs() / (displayRect.height / 2)).clamp(0.0, 1.0);
return (activeBound: bound, directionState: direction, progress: progress);
}