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?.maxheight ?? 0;
  if (maxHeight < 0) maxHeight = 0;

  double minHeight = widget.model.header?.height ?? widget.model.header?.minheight ?? 0;
  if (minHeight < 0) 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;
  headerModel.height  = height;
  bodyModel.height    = viewportHeight - height - (footerModel.height ?? 0) - viewportSafeArea.ceil();

  // Opacity Fade
  // if (widget.model.header!.animations == Animations.fade)
  // {
  //   headerModel.opacity = 0;
  //   if (maxHeight != 0) headerModel.opacity = height / maxHeight;
  // }

  /* Stop Notification Bubble */
  return false;
}