onScroll method

bool onScroll(
  1. ScrollNotification notification
)

Implementation

bool onScroll(ScrollNotification notification) {
  if ((notification.metrics.axisDirection == AxisDirection.left) ||
      (notification.metrics.axisDirection == AxisDirection.right)) {
    return false;
  }

  double maxHeight = widget.model.header?.height ??
      widget.model.header?.constraints.maxHeight ??
      0;
  if (maxHeight.isNegative) maxHeight = 0;

  double minHeight = widget.model.header?.height ??
      widget.model.header?.constraints.minHeight ??
      0;
  if (minHeight.isNegative) minHeight = 0;

  // Non-Resizeable Header
  if (minHeight == maxHeight) return true;
  double height;
  double scrolled = notification.metrics.pixels;
  scrolled = scrolled > maxHeight ? maxHeight : scrolled;

  height = maxHeight - scrolled;
  if (height < minHeight) height = minHeight;

  var viewportHeight = widget.model.system.maxHeight!;
  widget.model.header?.height = height;
  widget.model.height = viewportHeight -
      height -
      (widget.model.footer?.constraints.height ?? 0) -
      safeAreaHeight.ceil();

  /* Stop Notification Bubble */
  return false;
}