setDisableAnimations method
Updates the reduced-motion override.
Call this from State.didChangeDependencies() to automatically respect
the platform accessibility setting:
@override
void didChangeDependencies() {
super.didChangeDependencies();
_morph.setDisableAnimations(
MediaQuery.of(context).disableAnimations,
);
}
When disableAnimations is true, both open and close use the
MorphSpeed.instant spring profile — the overlay appears and disappears
in a single frame with no bouncing. This satisfies iOS and Android
"Reduce Motion" / "Remove Animations" accessibility requirements.
Implementation
void setDisableAnimations(bool disableAnimations) {
if (_disableAnimations == disableAnimations) return;
_disableAnimations = disableAnimations;
}