ScreenUtil class

Constructors

ScreenUtil()
factory

Properties

bottomBarHeight → double
底部安全区距离 dp The offset from the bottom, in dp
no setter
fontSizeResolver ↔ FontSizeResolver?
getter/setter pair
hashCode → int
The hash code for this object.
no setterinherited
orientation → Orientation
获取屏幕方向 Get screen orientation
no setter
pixelRatio → double?
设备的像素密度 The size of the media in logical pixels (e.g, the size of the screen).
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
scaleHeight → double
The ratio of actual height to UI design
no setter
scaleText → double
no setter
scaleWidth → double
实际尺寸与UI设计的比例 The ratio of actual width to UI design
no setter
screenHeight → double
当前设备高度 dp The vertical extent of this size. dp
no setter
screenWidth → double
当前设备宽度 dp The horizontal extent of this size.
no setter
statusBarHeight → double
状态栏高度 dp 刘海屏会更高 The offset from the top, in dp
no setter
textScaleFactor → double
每个逻辑像素的字体像素数,字体的缩放比例 The number of font pixels for each logical pixel.
no setter

Methods

deviceType(BuildContext context) → DeviceType
diagonal(num d) → double
Adapt according to the both width and height
diameter(num d) → double
Adapt according to the maximum value of scale width and scale height
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
radius(num r) → double
根据宽度或高度中的较小值进行适配 Adapt according to the smaller of width or height
setHeight(num height) → double
根据UI设计的设备高度适配 当发现UI设计中的一屏显示的与当前样式效果不符合时, 或者形状有差异时,建议使用此方法实现高度适配. 高度适配主要针对想根据UI设计的一屏展示一样的效果 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.
setHorizontalSpacing(num width) → SizedBox
setHorizontalSpacingDiagonal(num width) → SizedBox
setHorizontalSpacingDiameter(num width) → SizedBox
setHorizontalSpacingRadius(num width) → SizedBox
setSp(num fontSize) → double
字体大小适配方法
setVerticalSpacing(num height) → SizedBox
setVerticalSpacingDiagonal(num height) → SizedBox
setVerticalSpacingDiameter(num height) → SizedBox
setVerticalSpacingFromWidth(num height) → SizedBox
setVerticalSpacingRadius(num height) → SizedBox
setWidth(num width) → double
根据UI设计的设备宽度适配 高度也可以根据这个来做适配可以保证不变形,比如你想要一个正方形的时候. 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 Methods

configure({MediaQueryData? data, Size? designSize, bool? splitScreenMode, bool? minTextAdapt, FontSizeResolver? fontSizeResolver}) → void
enableScale({bool enableWH()?, bool enableText()?}) → void
Enable scale
ensureScreenSize([FlutterView? window, Duration duration = const Duration(milliseconds: 10)]) → Future<void>
Manually wait for window size to be initialized
ensureScreenSizeAndInit(BuildContext context, {Size designSize = defaultSize, bool splitScreenMode = false, bool minTextAdapt = false, FontSizeResolver? fontSizeResolver}) → Future<void>
init(BuildContext context, {Size designSize = defaultSize, bool splitScreenMode = false, bool minTextAdapt = false, FontSizeResolver? fontSizeResolver}) → void
Initializing the library.
registerToBuild(BuildContext context, [bool withDescendants = false]) → void
Experimental

Constants

defaultSize → const Size