UiUtil class

Constructors

UiUtil()
factory

Properties

bottomBarHeight double
底部安全区距离 dp
no setter
hashCode int
The hash code for this object.
no setterinherited
orientation Orientation
获取屏幕方向
no setter
pixelRatio double
设备的像素密度
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scaleHeight double
no setter
scaleText double
no setter
scaleWidth double
实际尺寸与UI设计的比例
no setter
screenHeight double
当前设备高度 dp
no setter
screenWidth double
当前设备宽度 dp
no setter
statusBarHeight double
状态栏高度 dp 刘海屏会更高
no setter
textScaleFactor double
每个逻辑像素的字体像素数,字体的缩放比例
no setter

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
radius(num r) double
根据宽度或高度中的较小值进行适配
setHeight(num height) double
根据UI设计的设备高度适配 高度适配主要针对想根据UI设计的一屏展示一样的效果
setSp(num fontSize, {bool? allowFontScalingSelf}) double
字体大小适配方法
setWidth(num width) double
根据UI设计的设备宽度适配
toString() String
A string representation of this object.
inherited

Operators

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

Static Properties

instance UiUtil
no setter

Static Methods

init({required BuildContext context, Size designSize = _defaultSize, Orientation orientation = Orientation.portrait, bool allowFontScaling = false}) → void