Information about a piece of media (e.g., a window).

For example, the MediaQueryData.size property contains the width and height of the current window.

To obtain the current MediaQueryData for a given BuildContext, use the MediaQuery.of function. For example, to obtain the size of the current window, use MediaQuery.of(context).size.

Constructors

MediaQueryData({Size size: Size.zero, double devicePixelRatio: 1.0, double textScaleFactor: 1.0, EdgeInsets padding: EdgeInsets.zero })

Creates data for a media query with explicit values.

const
MediaQueryData.fromWindow(Window window)

Creates data for a media query based on the given window.

Properties

devicePixelRatio double

The number of device pixels for each logical pixel. This number might not be a power of two. Indeed, it might not even be an integer. For example, the Nexus 6 has a device pixel ratio of 3.5.

read-only
hashCode int

read-only
orientation Orientation

The orientation of the media (e.g., whether the device is in landscape or portrait mode).

read-only
padding EdgeInsets

The padding around the edges of the media (e.g., the screen).

read-only
size Size

The size of the media in logical pixel (e.g, the size of the screen).

read-only
textScaleFactor double

The number of font pixels for each logical pixel.

read-only
runtimeType Type

A representation of the runtime type of the object.

read-only, inherited

Operators

operator ==(Object other) bool

The equality operator.

Methods

toString() String

Returns a string representation of this object.

noSuchMethod(Invocation invocation) → dynamic

Invoked when a non-existent method or property is accessed.

inherited