Support reduceMotion accessibility feature in MediaQuery - #190287
Conversation
Exposes the platform's "Reduce Motion" accessibility setting through MediaQueryData, so widgets can react to it with proper dependency tracking instead of reading it ad hoc off the platform dispatcher. The reduceMotion flag tracking the iOS "Reduce Motion" setting already exists at the engine layer as `dart:ui.AccessibilityFeatures.reduceMotion`, but it was never surfaced on MediaQueryData. This mirrors the existing disableAnimations support, which corresponds to Android's "Remove animations" setting. Unlike disableAnimations, reduceMotion is not consulted by framework-level animation APIs such as AnimationController. It is intended for widgets that want to tone down or replace non-essential motion, for example, by substituting a cross-fade for a slide. No engine or SemanticsBinding changes are required: as with disableAnimations, MediaQueryData reads reduceMotion directly from platformDispatcher.accessibilityFeatures, and FakeAccessibilityFeatures already supports the flag. Issue: flutter#4827 Issue: flutter#65874
There was a problem hiding this comment.
Code Review
This pull request introduces the reduceMotion accessibility setting to MediaQueryData and MediaQuery, allowing widgets to adapt to platform requests for reduced motion. It includes updates to constructor initialization, copying, equality checks, and static helper methods, along with corresponding unit tests. The reviewer pointed out that several methods in MediaQueryData that return new instances (such as removeViewPadding, padOuter, and removeDisplayFeatures) were not updated to copy the new reduceMotion property, which would cause the setting to be lost when those methods are called.
| highContrast: highContrast, | ||
| onOffSwitchLabels: onOffSwitchLabels, | ||
| disableAnimations: disableAnimations, | ||
| reduceMotion: reduceMotion, |
There was a problem hiding this comment.
It appears that several other methods in MediaQueryData that construct and return a new MediaQueryData instance—specifically removeViewPadding, padOuter, and removeDisplayFeatures—have not been updated to copy the reduceMotion property. Without updating these methods, the reduceMotion setting will be lost (resetting to false) when they are called.
Please ensure that reduceMotion: reduceMotion is added to the constructor calls in those methods as well.
There was a problem hiding this comment.
Bad bot.
My change already updates all methods that directly construct a MediaQueryData. removeViewPadding and removeDisplayFeatures delegate to copyWith, which I already updated to propagate reduceMotion.
There are three methods that call the constructor directly: copyWith (already done) applyTextStyleOverrides (already done), applyDisplayCornerRadii (already done).
specifically removeViewPadding, padOuter
The word padOuter doesn't appear a single time in MediaQueryData, or even media_query.dart... so errr, no...
There was a problem hiding this comment.
I apologize for the confusion in my previous comment. You are correct that padOuter is not present in MediaQueryData, and I appreciate the clarification regarding the delegation to copyWith. Since you have updated copyWith and the other methods that call the constructor directly, the implementation is correct. Thank you for the correction.
…12401) Manual roll Flutter from 2757a77a73df to e52f01c920ad (47 revisions) Manual roll requested by stuartmorgan@google.com flutter/flutter@2757a77...e52f01c 2026-07-31 jason-simmons@users.noreply.github.com [Impeller] Execute PipelineCompileQueue jobs in the order that they were added (flutter/flutter#190262) 2026-07-31 engine-flutter-autoroll@skia.org Roll Packages from 7d17fc8 to 5351d8c (5 revisions) (flutter/flutter#190351) 2026-07-31 engine-flutter-autoroll@skia.org Roll Skia from dcbd015c9646 to 7ef86a5b0eb9 (4 revisions) (flutter/flutter#190347) 2026-07-31 jason-simmons@users.noreply.github.com [Impeller] Do not acquire an unneeded image in KHRSwapchainVK if the swapchain must be recreated due to a size change (flutter/flutter#190116) 2026-07-31 jason-simmons@users.noreply.github.com Remove the --enable-serial-gc engine flag (flutter/flutter#190310) 2026-07-31 36861262+QuncCccccc@users.noreply.github.com Migrate platform_channel_swift example to material_ui (flutter/flutter#190308) 2026-07-31 chris@bracken.jp macOS: Set static text accessibility role for read-only text fields (flutter/flutter#190330) 2026-07-31 engine-flutter-autoroll@skia.org Roll Dart SDK from 96f49fc43f59 to c3acfc2479f6 (1 revision) (flutter/flutter#190336) 2026-07-31 engine-flutter-autoroll@skia.org Roll Skia from 07f08414dd66 to dcbd015c9646 (1 revision) (flutter/flutter#190333) 2026-07-31 zhongliu88889@gmail.com [web] Autofill all AutofillGroup fields in semantics mode (flutter/flutter#187108) 2026-07-31 chris@bracken.jp iOS: Configure test task runner thread at display QoS (flutter/flutter#190283) 2026-07-31 engine-flutter-autoroll@skia.org Roll Skia from a1109355de78 to 07f08414dd66 (5 revisions) (flutter/flutter#190328) 2026-07-31 chris@bracken.jp Support reduceMotion accessibility feature in MediaQuery (flutter/flutter#190287) 2026-07-30 engine-flutter-autoroll@skia.org Roll Dart SDK from 43f7de5f4977 to 96f49fc43f59 (4 revisions) (flutter/flutter#190312) 2026-07-30 mu7ammadkamel@hotmail.com fix: text selection two handles directionality. (flutter/flutter#179928) 2026-07-30 matt.boetger@gmail.com Add java/gradle check when gradle crashes (flutter/flutter#189997) 2026-07-30 41765610+ahyangnb@users.noreply.github.com [Impeller] Add filterQuality support to ImageFilter.shader (flutter/flutter#188544) 2026-07-30 dkwingsmt@users.noreply.github.com [flutter/flutter] Migrate multiple_windows example to material_ui (flutter/flutter#190313) 2026-07-30 engine-flutter-autoroll@skia.org Roll Skia from 50cf67910462 to a1109355de78 (6 revisions) (flutter/flutter#190306) 2026-07-30 31859944+LongCatIsLooong@users.noreply.github.com Migrate swift xctests to Swift testing tests (flutter/flutter#187801) 2026-07-30 36861262+QuncCccccc@users.noreply.github.com Migrates the platform_channel example to material_ui (flutter/flutter#190253) 2026-07-30 chris@bracken.jp iOS: Drop unnecessary @mainactor from VSyncClientTests (flutter/flutter#190285) 2026-07-30 evanwall@buffalo.edu Add nullptr check to isOpaque (flutter/flutter#189796) 2026-07-30 bdero@google.com [Flutter GPU] Bind uniforms and textures by cached reflection index (flutter/flutter#189820) 2026-07-30 jmccandless@google.com Migrate layers example to material_ui (flutter/flutter#190237) 2026-07-30 bernaferrari2@gmail.com Add `ShapeBorder` hit test fast paths (flutter/flutter#187962) 2026-07-30 codefu@google.com ci: mac-must-wait part duex (flutter/flutter#190295) 2026-07-30 engine-flutter-autoroll@skia.org Roll Skia from 491301f393d1 to 50cf67910462 (3 revisions) (flutter/flutter#190294) 2026-07-30 engine-flutter-autoroll@skia.org Roll Packages from dd11626 to 7d17fc8 (1 revision) (flutter/flutter#190293) 2026-07-30 engine-flutter-autoroll@skia.org Roll Skia from 177de1940bf2 to 491301f393d1 (1 revision) (flutter/flutter#190279) 2026-07-30 engine-flutter-autoroll@skia.org Roll Skia from b8bda91f02db to 177de1940bf2 (5 revisions) (flutter/flutter#190272) 2026-07-30 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from J8rVTlBnjnUpuHYk3... to _J8wM3kyQpLN9wvRD... (flutter/flutter#190273) 2026-07-30 engine-flutter-autoroll@skia.org Roll Skia from 78afc18c9ba0 to b8bda91f02db (3 revisions) (flutter/flutter#190268) 2026-07-30 154381524+flutteractionsbot@users.noreply.github.com Revert: Split the platform and cpuArch part of TargetPlatform (flutter/flutter#190258) 2026-07-30 developeryusuf@icloud.com Return null from RenderProxyBoxMixin.computeDryBaseline when the child has no baseline (flutter/flutter#189723) 2026-07-30 engine-flutter-autoroll@skia.org Roll Skia from 6fea713d32ec to 78afc18c9ba0 (4 revisions) (flutter/flutter#190257) 2026-07-30 137456488+flutter-pub-roller-bot@users.noreply.github.com Roll pub packages (flutter/flutter#190259) 2026-07-29 brackenavaron@gmail.com [cross imports] Check examples cross imports (flutter/flutter#187662) 2026-07-29 codefu@google.com ci: mac verify binaries still has to wait on linux_host_engine (flutter/flutter#190239) 2026-07-29 30870216+gaaclarke@users.noreply.github.com Adds analytics to macos impeller opt in/out (flutter/flutter#190220) 2026-07-29 engine-flutter-autoroll@skia.org Roll Skia from 0f35bba4945c to 6fea713d32ec (6 revisions) (flutter/flutter#190230) 2026-07-29 chris@bracken.jp iOS: Fix Swift warning in TracingTests (flutter/flutter#190203) 2026-07-29 matt.boetger@gmail.com Convert all gradle-wrapper.properties in /dev to use distribution 'bin' (flutter/flutter#190226) 2026-07-29 engine-flutter-autoroll@skia.org Roll Packages from 3e63635 to dd11626 (11 revisions) (flutter/flutter#190216) ...
Exposes the platform's "Reduce Motion" accessibility setting through MediaQueryData, so widgets can react to it with proper dependency tracking instead of reading it ad hoc off the platform dispatcher.
The reduceMotion flag tracking the iOS "Reduce Motion" setting already exists at the engine layer as
dart:ui.AccessibilityFeatures.reduceMotion, but it was never surfaced on MediaQueryData. This mirrors the existing disableAnimations support, which corresponds to Android's "Remove animations" setting.Unlike disableAnimations, reduceMotion is not consulted by framework-level animation APIs such as AnimationController. It is intended for widgets that want to tone down or replace non-essential motion, for example, by substituting a cross-fade for a slide.
No engine or SemanticsBinding changes are required: as with disableAnimations, MediaQueryData reads reduceMotion directly from platformDispatcher.accessibilityFeatures, and FakeAccessibilityFeatures already supports the flag.
Issue: #4827
Issue: #65874
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.
If this change needs to override an active code freeze, provide a comment explaining why. The code freeze workflow can be overridden by code reviewers. See pinned issues for any active code freezes with guidance.
Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the
gemini-code-assistbot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.