init static method
设置UI设计尺寸及相关信息
Implementation
static void init(
BuildContext context, {
Size designSize = defaultSize,
bool allowFontScaling = false,
}) {
_instance ??= LayoutTool._();
_instance!
..uiSize = designSize
..allowFontScaling = allowFontScaling;
MediaQueryData mediaQuery = MediaQuery.of(context);
_pixelRatio = mediaQuery.devicePixelRatio;
_screenWidth = mediaQuery.size.width;
_screenHeight = mediaQuery.size.height;
_statusBarHeight = mediaQuery.padding.top;
_bottomBarHeight = mediaQuery.padding.bottom;
_textScaleFactor = mediaQuery.textScaleFactor;
}