ScreenUtils class

Screen Util.

Constructors

ScreenUtils()

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

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
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

getBottomBarH(BuildContext context) double
status bar Height 当前BottomBar高度
getInstance() ScreenUtils
getMediaQueryData(BuildContext context) MediaQueryData
当前MediaQueryData
getOrientation(BuildContext context) Orientation
Orientation 设备方向(portrait, landscape)
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 当前状态栏高度