MediaQuery class

An inherited widget that provides MediaQueryData to its descendants.

Use MediaQuery.of to look up the current terminal dimensions.

Inheritance

Constructors

MediaQuery({Key? key, required MediaQueryData data, required Widget child})
Creates a MediaQuery with the given data.
const

Properties

child Widget
The widget below this inherited widget in the tree.
finalinherited
data MediaQueryData
The current media query data (terminal size, padding, etc.).
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another in the tree.
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

createElement() InheritedElement
Creates the Element for this widget.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
updateShouldNotify(covariant MediaQuery oldWidget) bool
Whether descendant widgets should be notified when data changes.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

maybeOf(BuildContext context) MediaQueryData
Returns the MediaQueryData from the closest MediaQuery ancestor, or a default 80×24 fallback if none is found.
of(BuildContext context) MediaQueryData
Returns the MediaQueryData from the closest MediaQuery ancestor.