cancelRunningTransition method

void cancelRunningTransition()

Implementation

void cancelRunningTransition() {
  if (_propertyRunningTransition.isNotEmpty) {
    final List<String> props = _propertyRunningTransition.keys.toList();
    for (final String prop in props) {
      final Animation? animation = _propertyRunningTransition.remove(prop);
      if (animation != null) {
        if (DebugFlags.shouldLogTransitionForProp(prop)) {
          cssLogger.info('[transition][cancel] property=$prop (bulk)');
        }
        animation.cancel();
      }
      // After cancel, re-apply the current computed property value to ensure
      // any animation-driven value is cleared immediately. The property
      // setter should clear any cached animation state when re-applying.
      final String computed = target.style.getPropertyValue(prop);
      target.setRenderStyle(prop, computed);
    }
  }
}