updateSize method

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

Implementation

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

  if (availablePixels == kStartOfTheViewport) {
    return;
  }
  final double clampedOffset = isAnimating
      ? math.max(minHeight, newHeight)
      : clampDouble(newHeight, minHeight, maxHeight);

  if (_offset == clampedOffset) {
    return;
  }

  if (!clipByHeader &&
      !isClosed &&
      _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;

  if (clampedOffset <= maxHeight) {
    isClosed = clampedOffset >= maxHeight;
  }

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