DeviceSize class
A single device configuration to render a screen at.
width and height are logical pixels (dp) -- the numbers you think in when you build a layout. pixelRatio is the device's physical-to-logical scale, used when driving a widget test's fake screen.
Constructors
- DeviceSize(String name, double width, double height, {double pixelRatio = 1.0})
-
const
Properties
- hashCode → int
-
The hash code for this object.
no setteroverride
- height → double
-
Logical height in dp.
final
- label → String
-
A compact label like "Small phone (320x568)".
no setter
- logicalSize → Size
-
Logical size (dp) -- what
MediaQuery.of(context).sizereports.no setter - name → String
-
Human-readable label, e.g. "Small phone".
final
- physicalSize → Size
-
Physical size (raw pixels) -- what a widget test's view expects.
no setter
- pixelRatio → double
-
Physical pixels per logical pixel.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- width → double
-
Logical width in dp.
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override
Constants
-
all
→ const List<
DeviceSize> - Everything, including the stress-test narrow foldable and a big tablet.
-
common
→ const List<
DeviceSize> - A sensible everyday matrix: small -> large phones + a tablet.
- compactPhone → const DeviceSize
- Compact modern phone.
- foldableNarrow → const DeviceSize
- Narrow folding phone in its folded (cover-screen) state -- the harshest common width, great for surfacing overflow early.
- largePhone → const DeviceSize
- Large phone (Pro Max class).
- smallPhone → const DeviceSize
- Small legacy phone (iPhone SE 1st gen class).
- standardPhone → const DeviceSize
- Standard modern phone (iPhone 14 class).
- tablet → const DeviceSize
- Standard tablet in portrait.
- tabletLarge → const DeviceSize
- Large tablet in portrait.