onActiveChanged method

void onActiveChanged()

Perform tasks when the animation's active state changes

Implementation

void onActiveChanged() {
  // If the animation stops and it is at the end of the one-shot, reset the
  // animation back to the starting time
  if (!isActive) {
    reset();
  }
  // Fire any callbacks
  isActive
      ? onStart?.call()
      // onStop can fire while widgets are still drawing
      : _ambiguate(WidgetsBinding.instance)
          ?.addPostFrameCallback((_) => onStop?.call());
}