processNotification method

void processNotification(
  1. ScrollNotification notification,
  2. ScrollController sender
)

Implementation

void processNotification(
    ScrollNotification notification, ScrollController sender) {
  if (notification is ScrollStartNotification && !_scrollingActive) {
    _scrollingController = sender;
    _scrollingActive = true;
    return;
  }

  if (identical(sender, _scrollingController) && _scrollingActive) {
    if (notification is ScrollEndNotification) {
      _registeredScrollControllers.forEach((controller) {
        if (!identical(_scrollingController, controller)) {
          if (controller.hasClients)
            controller.position.jumpTo(_scrollingController!.offset);
        }
      });

      _scrollingController = null;
      _scrollingActive = false;
      return;
    }

    if ((notification is ScrollUpdateNotification) &&
        (_scrollingController != null)) {
      _registeredScrollControllers.forEach((controller) {
        if (!identical(_scrollingController, controller)) {
          // TODO: Refactor - get rid of jumpToWithoutSettling
          if (controller.hasClients)
            controller.position.jumpToWithoutSettling(_scrollingController!
                .offset); // ignore: deprecated_member_use
          // controller.jumpTo(_scrollingController!.offset);
        }
      });
      return;
    }
  }
}