ScreenUtil class

Screen Util.

Constructors

ScreenUtil()

Properties

appBarHeight → double
appBar height appBar 高
no setter
bottomBarHeight → double
bottom bar Height
no setter
hashCode → int
The hash code for this object.
no setterinherited
mediaQueryData → MediaQueryData?
media Query Data
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
screenDensity → double
screen density 屏幕 像素密度
no setter
screenHeight → double
screen height 屏幕 高
no setter
screenWidth → double
screen width 屏幕 宽
no setter
statusBarHeight → double
status bar Height 状态栏高度
no setter

Methods

getAdapterSize(double dp) → double
兼容横/纵屏。 获取适配后的尺寸,兼容横/纵屏切换,可用于宽,高,字体尺寸适配。 Get the appropriate size, compatible with horizontal/vertical screen switching, can be used for wide, high, font size adaptation.
getHeight(double size) → double
仅支持纵屏。 returns the size after adaptation according to the screen height.(unit dp or pt) 返回根据屏幕高适配后尺寸(单位 dp or pt) size unit dp or pt
getHeightPx(double sizePx) → double
仅支持纵屏。 returns the size after adaptation according to the screen height.(unit dp or pt) 返回根据屏幕高适配后尺寸(单位 dp or pt) sizePx unit px
getRatio() → double
适配比率。 Ratio.
getSp(double fontSize) → double
仅支持纵屏。 returns the font size after adaptation according to the screen density. 返回根据屏幕宽适配后字体尺寸 fontSize 字体尺寸
getWidth(double size) → double
仅支持纵屏。 returns the size after adaptation according to the screen width.(unit dp or pt) 返回根据屏幕宽适配后尺寸(单位 dp or pt) size 单位 dp or pt
getWidthPx(double sizePx) → double
仅支持纵屏 returns the size after adaptation according to the screen width.(unit dp or pt) 返回根据屏幕宽适配后尺寸(单位 dp or pt) sizePx unit px
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

Static Methods

getAdapterSizeCtx(BuildContext context, double dp) → double
兼容横/纵屏。 获取适配后的尺寸,兼容横/纵屏切换,适应宽,高,字体尺寸。 Get the appropriate size, compatible with horizontal/vertical screen switching, can be used for wide, high, font size adaptation.
getBottomBarH(BuildContext context) → double
status bar Height 当前BottomBar高度
getInstance() → ScreenUtil
getMediaQueryData(BuildContext context) → MediaQueryData
当前MediaQueryData
getOrientation(BuildContext context) → Orientation
Orientation 设备方向(portrait, landscape)
getRatioCtx(BuildContext context) → double
适配比率。 Ratio.
getScaleH(BuildContext context, double size) → double
仅支持纵屏。 returns the size after adaptation according to the screen height.(unit dp or pt) 返回根据屏幕高适配后尺寸 (单位 dp or pt) size unit dp or pt
getScaleSp(BuildContext context, double fontSize) → double
仅支持纵屏。 returns the font size after adaptation according to the screen density. 返回根据屏幕宽适配后字体尺寸 fontSize 字体尺寸
getScaleW(BuildContext context, double size) → double
仅支持纵屏。 returns the size after adaptation according to the screen width.(unit dp or pt) 返回根据屏幕宽适配后尺寸(单位 dp or pt) size 单位 dp or pt
getScreenDensity(BuildContext context) → double
screen density 当前屏幕 像素密度
getScreenH(BuildContext context) → double
screen height 当前屏幕 高
getScreenW(BuildContext context) → double
screen width 当前屏幕 宽
getStatusBarH(BuildContext context) → double
status bar Height 当前状态栏高度