initialize static method
void
initialize(
{ - double standardSize = 750,
})
Implementation
static void initialize({double standardSize = 750}) {
//1、Physical resolution of mobile phone
physicalWidth = window.physicalSize.width;
physicalHeight = window.physicalSize.height;
//2、get dpr
dpr = window.devicePixelRatio;
//3、Get the size of the phone screen (logical resolution)
screenWidth = physicalWidth / dpr;
screenHeight = physicalHeight / dpr;
//4、Status bar height/Bottom safety zone height
statusHeight = window.padding.top / dpr;
bottomHeight = window.padding.bottom / dpr;
//5、Calculate the size of rpx/px
rpx = screenWidth / standardSize;
px = screenWidth / standardSize * 2;
}