processNotification method

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

Implementation

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

  if (identical(sender, _scrollingController) && _scrollingActive) {
    if (notification is ScrollEndNotification) {
      _scrollingController = null;
      _scrollingActive = false;
      return;
    }

    if (notification is ScrollUpdateNotification) {
      _registeredScrollControllers.forEach(
        (controller) {
          if (!identical(_scrollingController, controller)) {
            if (controller.hasClients) {
              if (_refreshController != null) {
                switch (label) {
                  case leftScrollControllerLabel:
                    {
                      if (_scrollingController != null) {
                        _syncRightListViewScrollVontroller(
                            _scrollingController!, controller);
                      }
                      break;
                    }
                  case rightScrollControllerLabel:
                    {
                      if (_scrollingController != null) {
                        _syncLeftListViewScrollVontroller(
                            _scrollingController!, controller);
                      }
                      break;
                    }
                }
              } else {
                controller.jumpTo(_scrollingController?.offset ?? 0);
              }
            }
          }
        },
      );
      return;
    }
  }
}