updateEvents method

  1. @override
void updateEvents(
  1. ListItemViewModel renderViewModel,
  2. Set<EventHolder> holders
)
override

Implementation

@override
void updateEvents(
  ListItemViewModel renderViewModel,
  Set<EventHolder> holders,
) {
  super.updateEvents(renderViewModel, holders);
  if (holders.isNotEmpty) {
    var pv = renderViewModel.parent;
    if (pv is ListViewModel) {
      for (var holder in holders) {
        switch (holder.eventName) {
          case kEventOnAppear:
            if (holder.isAdd) {
              pv.scrollGestureDispatcher.appearEventEnableIdList.add(renderViewModel.id);
            } else {
              pv.scrollGestureDispatcher.appearEventEnableIdList.remove(renderViewModel.id);
            }
            break;
          case kEventOnDisAppear:
            if (holder.isAdd) {
              pv.scrollGestureDispatcher.disAppearEventEnableIdList.add(renderViewModel.id);
            } else {
              pv.scrollGestureDispatcher.disAppearEventEnableIdList.remove(renderViewModel.id);
            }
            break;
          case kEventOnWillAppear:
            if (holder.isAdd) {
              pv.scrollGestureDispatcher.willAppearEventEnableIdList.add(renderViewModel.id);
            } else {
              pv.scrollGestureDispatcher.willAppearEventEnableIdList.remove(renderViewModel.id);
            }
            break;
          case kEventOnWillDisAppear:
            if (holder.isAdd) {
              pv.scrollGestureDispatcher.willDisAppearEventEnableIdList.add(renderViewModel.id);
            } else {
              pv.scrollGestureDispatcher.willDisAppearEventEnableIdList
                  .remove(renderViewModel.id);
            }
            break;
        }
      }
    }
  }
}