animateToValue method
Runs the position animation to transition the Toggleable's appearance to match value.
This method must be called whenever value changes to ensure that the visual representation of the Toggleable matches the current value.
Implementation
void animateToValue() {
if (tristate) {
if (value == null) {
_positionController.value = 0.0;
}
if (value ?? true) {
_positionController.forward();
} else {
_positionController.reverse();
}
} else {
if (value ?? false) {
_positionController.forward();
} else {
_positionController.reverse();
}
}
}