DeviceInfo class

Info about a device and its frame.

Constructors

DeviceInfo({required DeviceIdentifier identifier, required String name, EdgeInsets? rotatedSafeAreas, required Size frameSize, required EdgeInsets safeAreas, required double pixelRatio, required Size screenSize, required Path screenPath})
Device screen configuration.
const
DeviceInfo.genericPhone({required TargetPlatform platform, required String id, required String name, required Size screenSize, EdgeInsets safeAreas = EdgeInsets.zero, EdgeInsets rotatedSafeAreas = EdgeInsets.zero, double pixelRatio = 2.0})
Create phone screen configuration.
factory
DeviceInfo.genericTablet({required TargetPlatform platform, required String id, required String name, required Size screenSize, EdgeInsets safeAreas = EdgeInsets.zero, EdgeInsets rotatedSafeAreas = EdgeInsets.zero, double pixelRatio = 2.0})
Create tablet screen configuration.
factory

Properties

canRotate bool
Indicates whether the device can rotate.
no setter
frameSize Size
The frame size in pixels.
final
hashCode int
The hash code for this object.
no setterinherited
identifier DeviceIdentifier
Identifier of the device.
final
name String
The display name of the device.
final
pixelRatio double
The screen pixel density of the device.
final
rotatedSafeAreas EdgeInsets?
The safe areas when the device is in landscape orientation.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
safeAreas EdgeInsets
The safe areas when the device is in portrait orientation.
final
screenPath Path
A shape representing the screen.
final
screenSize Size
The size in points of the screen content.
final

Methods

frameSizeOn(Orientation orientation) Size
The frame size choice depends on the orientation.
isLandscape(Orientation orientation) bool
Indicates whether the current device info should be in landscape.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
safeAreasOn(Orientation orientation) EdgeInsets
The safe area choice depends on the orientation.
screenPathBoundsOn(Orientation orientation) Size
The screen path bounds choice depends on the orientation.
screenSizeOn(Orientation orientation) Size
The screen size choice depends on the orientation.
toString() String
A string representation of this object.
inherited

Operators

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

Static Methods

calculatePhoneFrameSize(Size screenSize) Size
Helper to calculate generic phone frame size.
calculateTabletFrameSize(Size screenSize) Size
Helper to calculate generic tablet frame size.
createPhoneScreenPath(Size screenSize) Path
Helper to create generic phone screen path.
createTabletScreenPath(Size screenSize) Path
Helper to create generic tablet screen path.