shouldTransition method
Implementation
bool shouldTransition(String property, String? prevValue, String nextValue) {
// When begin propertyValue is AUTO, skip animation and trigger style update directly.
prevValue ??= CSSInitialValues[property];
if (CSSLength.isAuto(prevValue) || CSSLength.isAuto(nextValue)) {
return false;
}
// Transition does not work when renderBoxModel has not been layout yet.
if (renderBoxModel != null && renderBoxModel!.hasSize && CSSTransitionHandlers[property] != null &&
(effectiveTransitions.containsKey(property) || effectiveTransitions.containsKey(ALL))) {
bool shouldTransition = false;
// Transition will be disabled when all transition has transitionDuration as 0.
effectiveTransitions.forEach((String transitionKey, List transitionOptions) {
int? duration = CSSTime.parseTime(transitionOptions[0]);
if (duration != null && duration != 0) {
shouldTransition = true;
}
});
return shouldTransition;
}
return false;
}