flutter3d
Showcase Changelog 38 packages API reference

Reduce motion

since 0.7.0 or earlier Widgets and the rest

Somebody who is made ill by moving pictures has already turned Reduce Motion on, in the system settings, probably years ago. A game that ignores that and offers its own slider three menus deep asks them to solve the same problem again, in a menu they may have to get through a moving camera to reach.

Note. flutter3d_game's real Accommodations is not a dependency of this app. This page reimplements its nine lines, calling the same MediaQuery.maybeDisableAnimationsOf Flutter already exposes, so the numbers below answer to this device's actual setting.

Step 1: A default, never an override #

/// A default, never an override: a game reads this where the player has not
/// said otherwise, and a slider they moved themselves still wins.
final class _Accommodations {
  const _Accommodations({this.reduceMotion = false});

  factory _Accommodations.of(BuildContext context) => _Accommodations(
    reduceMotion: MediaQuery.maybeDisableAnimationsOf(context) ?? false,
  );

  final bool reduceMotion;

  /// Nought when the player has asked for less movement: a camera that
  /// shakes on every landing is exactly what the system setting is about.
  double get cameraMotion => reduceMotion ? 0.0 : 1.0;

  /// The same fallback for a full-screen flash, kept separate because a
  /// flash is a photosensitivity question and a moving camera is a
  /// vestibular one.
  double get screenFlash => reduceMotion ? 0.0 : 1.0;
}

Step 2: Read what the platform already says #

final accommodations = _Accommodations.of(buildContext);

Step 3: Compare the two states #

const off = _Accommodations();
const on = _Accommodations(reduceMotion: true);

With the system setting off, a camera's own motion defaults to full. With it on, the default is nought — a starting point a game's own slider can still move away from, since this is a fallback and not a lock.