DeviceScreen class

One physical display of a device.

Most devices have a single screen. Foldables have two: the main screen first and the cover screen second, selected by DeviceSpec.screenFor.

Annotations

Constructors

DeviceScreen({required String label, required Size logicalSize, required double pixelRatio, required EdgeInsets safeArea, EdgeInsets? safeAreaRotated, List<ScreenCutout> cutouts = const [], HingeSpec? hinge, double cornerRadius = 0, BorderRadius? corners, bool rotatable = true, Orientation naturalOrientation = Orientation.portrait, DeviceFrame? frame, double? ppi})
const

Properties

aspectRatio → double
Height divided by width in portrait.
no setter
borderRadius → BorderRadius
The screen's corner rounding in its natural orientation.
no setter
cornerRadius → double
Corner rounding in logical pixels, used to clip the preview.
final
corners → BorderRadius?
Per-corner rounding, overriding cornerRadius when set.
final
cutouts → List<ScreenCutout>
Camera intrusions on this screen.
final
frame → DeviceFrame?
The body drawn around this screen, overriding DeviceSpec.frame.
final
hashCode → int
The hash code for this object.
no setterinherited
hinge → HingeSpec?
The fold, when this screen is the inner display of a foldable.
final
label → String
Human readable name, such as Main or Cover.
final
logicalSize → Size
Size in logical pixels with the device held in portrait.
final
naturalOrientation → Orientation
The orientation this screen is designed to be held in.
final
pixelRatio → double
Ratio of physical to logical pixels.
final
ppi → double?
Pixel density in pixels per inch, when the vendor publishes it.
final
resolution → Size
Size in physical pixels, that is logicalSize times pixelRatio.
no setter
rotatable → bool
Whether the orientation toggle applies to this screen.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
safeArea → EdgeInsets
Insets in the screen's naturalOrientation.
final
safeAreaRotated → EdgeInsets
Insets when the device is turned 90 degrees from naturalOrientation.
no setter

Methods

borderRadiusFor(Orientation orientation) → BorderRadius
borderRadius for the given orientation, turned with the device.
copyWith({String? label, Size? logicalSize, double? pixelRatio, EdgeInsets? safeArea, EdgeInsets? safeAreaRotated, List<ScreenCutout>? cutouts, HingeSpec? hinge, double? cornerRadius, BorderRadius? corners, DeviceFrame? frame, double? ppi}) → DeviceScreen
A copy of this screen with the given fields replaced.
cutoutRectsFor(Orientation orientation) → List<Rect>
Where each entry of cutouts sits on the screen in the given orientation, in the same order.
displayFeaturesFor(Orientation orientation, FoldPosture posture) → List<DisplayFeature>
Display features to publish for the given orientation and posture.
hingeAxisFor(Orientation orientation) → Axis
The hinge axis once the device is rotated into orientation.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
paddingFor(Orientation orientation) → EdgeInsets
Safe area insets for the given orientation.
sizeFor(Orientation orientation) → Size
logicalSize for the given orientation, with the axes swapped for landscape.
toString() → String
A string representation of this object.
inherited

Operators

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