defaultScreenInit function

void defaultScreenInit(
  1. BuildContext context,
  2. LayoutInfo layoutInfo
)

Implementation

void defaultScreenInit(BuildContext context, LayoutInfo layoutInfo) {
  SunnyColors.init();
  SunnyColors.resolveBrightness(context);

  // final pixelRatio = WidgetsBinding.instance.window.devicePixelRatio;
  // final physicalWidth = WidgetsBinding.instance.window.physicalSize.width;
  final props = layoutInfo.screenType == DeviceScreenType.mobile
      ? ScreenScale.init(
          width: 375, allowFontScaling: true, allowSubpixel: true)
      : layoutInfo.screenType == DeviceScreenType.desktop
          ? ScreenScale.init(
              width: 375,
              maxWidth: 375,
              allowFontScaling: false,
              allowSubpixel: false)
          : ScreenScale.init(
              width: 375,
              maxWidth: 640,
              allowFontScaling: false,
              allowSubpixel: false);

  final textScaleFactor = props.scaleText;
  TextWidgets.lightColor = sunnyColors.g600;
  SunnyTextTheme.setFontScale(textScaleFactor);
  SunnyTextTheme.setBrightness(context);
  SunnySpacing.setScaleFactor(textScaleFactor);
  CupertinoVisualStyle.instance = CupertinoVisualStyle();
}