DisplayModel class

Inputs describing a physical display. Call compute to derive DisplayMetrics.

Physical size may be given as widthMm/heightMm (e.g. from EDID) or as diagonalInches (e.g. from a spec sheet). If neither supplies a finite, positive density, the model falls back to assuming a 96dpi desktop monitor. Valid densities are not limited: a density cutoff would make small changes in physical size abruptly switch between calculated and fallback scales.

Constructors

DisplayModel({required int widthPx, required int heightPx, double? widthMm, double? heightMm, double? diagonalInches, DisplayUsage? usage, double? viewingDistanceMm, double userScaleFactor = 1.0, TouchTargets? touch, double integerSnapTolerance = 0.02})

Properties

diagonalInches → double?
Alternative to widthMm/heightMm: diagonal in inches, per spec sheet.
final
hashCode → int
The hash code for this object.
no setterinherited
heightMm → double?
final
heightPx → int
final
integerSnapTolerance → double
Snap scale to a nearby integer within this relative tolerance (e.g. 1.985 -> 2.0). Bitmap assets and 1px hairlines render dramatically crisper at integer scales, and a ~2% size change is imperceptible.
final
pxPerMm → double?
Pixel density in px/mm, or null if unknown or invalid.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
touch → TouchTargets?
If non-null, enforce a minimum physical touch-target size.
final
usage → DisplayUsage?
Usage class supplying a default viewing distance.
final
userScaleFactor → double
User preference multiplier, applied last. Callers should report the reduced logical resolution honestly so layout reflows rather than zoom-cropping.
final
viewingDistanceMm → double?
Measured/configured viewing distance; overrides usage if set.
final
widthMm → double?
Physical width/height of the display area, in millimeters, if known.
final
widthPx → int
final

Methods

compute() → DisplayMetrics
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

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