ScreenUtil class

Constructors

ScreenUtil()
factory

Properties

allowFontScaling bool
allowFontScaling Specifies whether fonts should scale to respect Text Size accessibility settings. The default is false.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scaleHeight double
no setter
scaleText double
no setter
scaleWidth double
The ratio of the actual dp to the design draft px
no setter
uiHeightPx num
getter/setter pair
uiWidthPx num
Size of the phone in UI Design , px
getter/setter pair

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
setHeight(num height) num
Highly adaptable to the device according to UI Design It is recommended to use this method to achieve a high degree of adaptation when it is found that one screen in the UI design does not match the current style effect, or if there is a difference in shape.
setSp(num fontSize, {bool? allowFontScalingSelf}) num
Font size adaptation method
setWidth(num width) num
Adapted to the device width of the UI Design. Height can also be adapted according to this to ensure no deformation , if you want a square
toString() String
A string representation of this object.
inherited

Operators

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

Static Properties

bottomBarHeight double?
The offset from the bottom.
no setter
mediaQueryData MediaQueryData?
no setter
pixelRatio double?
The size of the media in logical pixels (e.g, the size of the screen).
no setter
screenHeight double
The vertical extent of this size. px
no setter
screenHeightDp double?
The vertical extent of this size. dp
no setter
screenWidth double
The vertical extent of this size. px
no setter
screenWidthDp double?
The horizontal extent of this size.
no setter
statusBarHeight double?
The offset from the top
no setter
textScaleFactor double?
The number of font pixels for each logical pixel.
no setter

Static Methods

init(BuildContext context, {num width = defaultWidth, num height = defaultHeight, bool allowFontScaling = false}) → void

Constants

defaultHeight → const int
defaultWidth → const int