maybeStartSnapAnimation method Null safety

void maybeStartSnapAnimation(
  1. ScrollDirection direction
)

If the header isn't already fully exposed, then scroll it into view.

Implementation

void maybeStartSnapAnimation(ScrollDirection direction) {
  final FloatingHeaderSnapConfiguration? snap = snapConfiguration;
  if (snap == null)
    return;
  if (direction == ScrollDirection.forward && _effectiveScrollOffset! <= 0.0)
    return;
  if (direction == ScrollDirection.reverse && _effectiveScrollOffset! >= maxExtent)
    return;

  _updateAnimation(
    snap.duration,
    direction == ScrollDirection.forward ? 0.0 : maxExtent,
    snap.curve,
  );
  _controller?.forward(from: 0.0);
}