getSize static method
根据设置的宽度,来得到对应的高度
Implementation
static Size getSize() {
// 如果是横屏就已宽度为基准
var originalSize = window.physicalSize / window.devicePixelRatio;
var originalWidth = originalSize.width;
var originalHeight = originalSize.height;
if (originalHeight > originalWidth) {
// 竖屏
_screenHeight = window.physicalSize.height / getDevicePixelRatio();
_screenWidth = _screenStandard;
_screenSize = Size(_screenStandard, _screenHeight);
return _screenSize;
} else {
// 横屏
_screenWidth = window.physicalSize.width / getDevicePixelRatio();
_screenHeight = _screenStandard;
_screenSize = Size(_screenWidth, _screenStandard);
return _screenSize;
}
}