updateShouldNotifyDependent method

  1. @override
bool updateShouldNotifyDependent(
  1. covariant OudsInheritedInteractionModel oldWidget,
  2. Set<InteractionAspect> aspects
)
override

Return true if the changes between this model and oldWidget match any of the dependencies.

Implementation

@override
bool updateShouldNotifyDependent(OudsInheritedInteractionModel oldWidget, Set<InteractionAspect> aspects) {
  if (aspects.contains(InteractionAspect.hover) && state.isHovered != oldWidget.state.isHovered) {
    return true;
  }
  if (aspects.contains(InteractionAspect.pressed) && state.isPressed != oldWidget.state.isPressed) {
    return true;
  }
  return false;
}