shouldRecomputeThisFrame method

bool shouldRecomputeThisFrame({
  1. required bool hasActiveAnimations,
  2. required double scrollOffset,
})

Returns true when sticky should be recomputed this frame. The throttle keeps mid-animation frames cheap (every third frame) but fires on every scroll, since stale pinnedY values produce visible jitter and wrong hit-test coordinates.

Implementation

bool shouldRecomputeThisFrame({
  required bool hasActiveAnimations,
  required double scrollOffset,
}) {
  final scrolledSinceLast = _lastStickyScrollOffset != scrollOffset;
  if (hasActiveAnimations && _maxStickyDepth > 0) {
    _throttleCounter++;
    return scrolledSinceLast || (_throttleCounter % 3) == 0;
  }
  _throttleCounter = 0;
  return true;
}