Establishes a subtree in which media queries resolve to the given data.
For example, to learn the size of the current media (e.g., the window containing your app), you can use MediaQuery.sizeOf: MediaQuery.sizeOf(context).
Querying the current media using specific methods (for example, MediaQuery.sizeOf and MediaQuery.paddingOf) will cause your widget to rebuild automatically whenever the property you query changes.
On the other hand, querying using MediaQuery.of will cause your widget to rebuild automatically whenever any field of the MediaQueryData changes (e.g., if the user rotates their device). Therefore, if you are only concerned with one or a few fields of MediaQueryData, prefer using the specific methods (for example: MediaQuery.sizeOf and MediaQuery.paddingOf).
If no MediaQuery is in scope then the series of methods like MediaQuery.of and MediaQuery.sizeOf will throw an exception. Alternatively, the "maybe-" variant methods (such as MediaQuery.maybeOf and MediaQuery.maybeSizeOf) can be used, which returns null instead of throwing if no MediaQuery is in scope
The platform the material widgets should adapt to target.
Defaults to the current platform, as exposed by defaultTargetPlatform. This should be used in order to style UI elements according to platform conventions.
Widgets from the Delta library should use this getter (via Delta.data) to determine the current platform for the purpose of emulating the platform behavior (e.g. scrolling or haptic effects). Widgets and render objects at lower layers that try to emulate the underlying platform can depend on defaultTargetPlatform directly, or may require that the target platform be provided as an argument. The dart:io.Platform object should only be used directly when it's critical to actually know the current platform, without any overrides possible (for example, when a system API is about to be called).
In a test environment, the platform returned is TargetPlatform.android regardless of the host platform. (Android was chosen because the tests were originally written assuming Android-like behavior, and we added platform adaptations for other platforms later). Tests can check behavior for other platforms by setting the platform of the Theme explicitly to another TargetPlatform value, or by setting debugDefaultTargetPlatformOverride.
Determines the defaults for typography and materialTapTargetSize.
The number of font pixels for each logical pixel.
For example, if the text scale factor is 1.5, text will be 50% larger than the specified font size.
See also:
MediaQuery.textScaleFactorOf, a method to find and depend on the textScaleFactor defined for a BuildContext