updateSize method

void updateSize(
  1. double newOffset, {
  2. bool isAnimating = false,
  3. bool notify = true,
})

Implementation

void updateSize(double newOffset,
    {bool isAnimating = false, bool notify = true}) {
  _cancelActivity?.call();
  _cancelActivity = null;

  if (availablePixels == kStartOfTheViewport) {
    return;
  }
  final double clampedOffset = isAnimating
      ? newOffset
      : clampDouble(newOffset, minOffset, safeMaxOffset);

  if (_offset == clampedOffset) {
    return;
  }

  if (!behavior.clipByHeader &&
      _offset < availablePixels &&
      clampedOffset == availablePixels &&
      _safeAreaAnimationController?.value == 0.0) {
    _safeAreaAnimationController?.animateTo(1.0, curve: Curves.easeOut);
  } else if (clampedOffset < availablePixels) {
    _safeAreaAnimationController?.value = 0.0;
  }

  _offset = clampedOffset;

  updateState();

  if (notify) {
    onOffsetChanged?.call();
  }
}