init static method
void
init(
- BoxConstraints constraints, {
- Orientation orientation = Orientation.portrait,
- Size designSize = defaultSize,
Implementation
static void init(
BoxConstraints constraints, {
Orientation orientation = Orientation.portrait,
Size designSize = defaultSize,
}) {
if (_instance != null) {
debugPrint("ScreenUtil has init");
return;
}
_instance = ScreenUtil._()
..uiSize = designSize
.._orientation = orientation
.._screenWidth = constraints.maxWidth
.._screenHeight = constraints.maxHeight;
var window = WidgetsBinding.instance?.window ?? ui.window;
_instance._pixelRatio = window.devicePixelRatio;
_instance._statusBarHeight = window.padding.top;
_instance._bottomBarHeight = window.padding.bottom;
_instance._textScaleFactor = window.textScaleFactor;
}