DesignScaleUtils class

A design scaling utility to adapt your UI to different screen sizes.

Call DesignScaleUtils.instance.init once, preferably in your root widget tree.

Constructors

DesignScaleUtils()
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scaleHeightFactor double
no setter
scaleWidthFactor double
Exposed for debugging/testing.
no setter

Methods

init({required double designWidth, required double designHeight, required MediaQueryData mediaQuery, bool isLoggingEnabled = false}) → void
Initialize the scaling factors with a reference design frame.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
scaleFont(num size, {double minScale = 0.9, double maxScale = 1.2}) double
Scale font size using the average scale and clamp within optional bounds.
scaleHeight(num height) double
Scale height based on design height and current screen height.
scaleRadius(num radius, {double minScale = 0.9, double maxScale = 1.2}) double
Scale radius using the average scale and clamp within optional bounds.
scaleWidth(num width) double
Scale width based on design width and current screen width.
toString() String
A string representation of this object.
inherited

Operators

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

Static Properties

instance DesignScaleUtils
no setter