PrismMotionContext extension

Motion that respects the user's accessibility settings.

Roughly one in three people who enable "reduce motion" do so because animation causes them dizziness, nausea or migraine. A component library that ignores that setting is unusable for them, so every animated Prism component asks for its duration through here rather than reading it straight from the theme.

AnimatedSwitcher(
  duration: context.prismMotion(tokens.durationMedium),
  child: child,
);
on

Properties

prismReduceMotion → bool

Available on BuildContext, provided by the PrismMotionContext extension

Whether the platform currently asks for reduced motion.
no setter

Methods

prismMotion(Duration preferred) → Duration

Available on BuildContext, provided by the PrismMotionContext extension

Returns preferred, or Duration.zero when the platform asks for reduced motion.