Repository navigation
Improve docs on MediaQuery: highContrast, invertColors and disableAnimations #78323
Description
Activity
Did you read the description of what these fields do?
https://api.flutter.dev/flutter/widgets/MediaQueryData/invertColors.html
Whether the device is inverting the colors of the platform.
This does not indicate that the application should be painted inverted: The OS is already doing that.
That is what most of these settings do - indicate that the OS is already performing some action, to allow the framework to react. For example, re-inverting images so that pictures do not appear inverted, and removing the timeout of snackbars when a screen-reader is enabled
We should probably rename this field to
osRequestedColorsInvertedand similarly for the others. cc @goderbauerchanging dart:ui is probably too hard, but MediaQueryData is feasible
- addedin triagePresently being triaged by the triage teamPresently being triaged by the triage team
on Mar 17, 2021 - changed the title
[-]Setting highContrast and invertColors in MediaQuery does not affect the app.[/-][+]Rename OS properties on MediaQuery: highContrast, invertColors and disableAnimations[/+]on Mar 17, 2021 - addedframeworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.c: proposalA detailed proposal for a change to FlutterA detailed proposal for a change to Flutterand removedin triagePresently being triaged by the triage teamPresently being triaged by the triage team
on Mar 17, 2021 Did you read the description of what these fields do?
https://api.flutter.dev/flutter/widgets/MediaQueryData/invertColors.html
Whether the device is inverting the colors of the platform.
This does not indicate that the application should be painted inverted: The OS is already doing that.
That is what most of these settings do - indicate that the OS is already performing some action, to allow the framework to react. For example, re-inverting images so that pictures do not appear inverted, and removing the timeout of snackbars when a screen-reader is enabled
Thanks for the reply.
I better understand now what the documentation means. I wonder if it could be better explained.
For instance, if you change
boldTextas shown in the example above, it changes in the app, but the description in the documentation is similar: https://api.flutter.dev/flutter/widgets/MediaQueryData/boldText.htmlWhether the platform is requesting that text be drawn with a bold font weight.
For
disableAnimationshttps://api.flutter.dev/flutter/widgets/MediaQueryData/disableAnimations.html:Whether the platform is requesting that animations be disabled or reduced as much as possible.
For
highContrasthttps://api.flutter.dev/flutter/widgets/MediaQueryData/highContrast.htmlWhether the user requested a high contrast between foreground and background content on iOS, via Settings -> Accessibility -> Increase Contrast.
Maybe a rephrasing of this
This does not indicate that the application should be painted inverted: The OS is already doing that.
That is what most of these settings do - indicate that the OS is already performing some action, to allow the framework to react. For example, re-inverting images so that pictures do not appear inverted, and removing the timeout of snackbars when a screen-reader is enabled
could be added to the documentation.
PRs to improve the documentation are very welcome!
I agree, that we could have named these better, but I don't think we should make renaming these a high priority. It's something we could add to #24722, though.
That is what most of these settings do - indicate that the OS is already performing some action, to allow the framework to react
that's it, MediaQuery doesn't guarantee the way framework reacts to the data it provides, as it's just a representation of OS settings, and to me something like
osRequestedColorsInvertedlooks too verbose, as "osRequested" part is already in MediaQuery class by definition- addedP2Important issues not at the top of the work listImportant issues not at the top of the work list
on May 18, 2022 - changed the title
[-]Rename OS properties on MediaQuery: highContrast, invertColors and disableAnimations[/-][+]Improve docs on MediaQuery: highContrast, invertColors and disableAnimations[/+]on May 18, 2022 - addedd: api docsIssues with https://api.flutter.dev/Issues with https://api.flutter.dev/
on Jul 5, 2023 - addedteam-frameworkOwned by Framework teamOwned by Framework teamtriaged-frameworkTriaged by Framework teamTriaged by Framework team
on Jul 8, 2023 - added a commit that references this issue
on Jun 11, 2026 - added a commit that references this issue
on Jun 26, 2026 This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.- locked as resolved and limited conversation to collaborators
on Jul 14, 2026
Changing the values of
highContrast,invertColors, and maybedisableAnimations, in aMediaQuerydoes not affect the app.I am not sure how to test
disableAnimations, in another project I created some animations and set the simulator to Reduce motion but I could not see any difference, so I am not sure how I could test this.Note that
boldText, which is set inMediaQueryin the same way, works as expected (see below).Steps to Reproduce
flutter create bug.darkTheme,highContrastTheme, andhighContrastDarkThemeto theMaterialApp. For instance:bool _switchValues = false;property to_MyHomePageState._switchValues = !_switchValues;to thesetStatein_incrementCounter().Scaffoldwith aMediaQuerywithdata:Expected results:
Actual results:
Logs
Full code