init static method

dynamic init({
  1. double? standardLogicalWidth,
  2. double? standardLogicalHeight,
})

Implementation

static init({double? standardLogicalWidth, double? standardLogicalHeight}) {
  _standardLogicalWidth = standardLogicalWidth;
  _standardLogicalHeight = standardLogicalHeight;

  unitPadding.topSafeArea =
      MediaQueryData.fromView(PlatformDispatcher.instance.views.single)
          .padding
          .top;
  unitPadding.bottomSafeArea =
      MediaQueryData.fromView(PlatformDispatcher.instance.views.single)
          .padding
          .bottom;

  unitPadding.safeAreaPadding =
      unitPadding.topSafeArea + unitPadding.bottomSafeArea;

  unitWidth.max =
      MediaQueryData.fromView(PlatformDispatcher.instance.views.single)
          .size
          .width;

  unitHeight.max =
      MediaQueryData.fromView(PlatformDispatcher.instance.views.single)
          .size
          .height;

  unitWidth.standard = _standardLogicalWidth ?? unitWidth.max;
  unitHeight.standard = _standardLogicalHeight ?? unitHeight.max;

  unitWidth.lp4 = unitWidth.max / (unitWidth.standard / 4);
  unitHeight.lp4 = unitHeight.max / (unitHeight.standard / 4);

  unitWidth.lp8 = unitWidth.lp4 * 2;
  unitWidth.lp12 = unitWidth.lp4 * 3;
  unitWidth.lp16 = unitWidth.lp4 * 4;
  unitWidth.lp20 = unitWidth.lp4 * 5;
  unitWidth.lp24 = unitWidth.lp4 * 6;
  unitWidth.lp28 = unitWidth.lp4 * 7;
  unitWidth.lp32 = unitWidth.lp4 * 8;
  unitWidth.lp36 = unitWidth.lp4 * 9;
  unitWidth.lp40 = unitWidth.lp4 * 10;
  unitWidth.lp44 = unitWidth.lp4 * 11;
  unitWidth.lp48 = unitWidth.lp4 * 12;
  unitWidth.lp52 = unitWidth.lp4 * 13;
  unitWidth.lp56 = unitWidth.lp4 * 14;
  unitWidth.lp60 = unitWidth.lp4 * 15;
  unitWidth.lp64 = unitWidth.lp4 * 16;
  unitWidth.lp68 = unitWidth.lp4 * 17;
  unitWidth.lp72 = unitWidth.lp4 * 18;
  unitWidth.lp76 = unitWidth.lp4 * 19;
  unitWidth.lp80 = unitWidth.lp4 * 20;
  unitWidth.lp84 = unitWidth.lp4 * 21;
  unitWidth.lp88 = unitWidth.lp4 * 22;
  unitWidth.lp92 = unitWidth.lp4 * 23;
  unitWidth.lp96 = unitWidth.lp4 * 24;
  unitWidth.lp100 = unitWidth.lp4 * 25;
  unitWidth.lp104 = unitWidth.lp4 * 26;
  unitWidth.lp108 = unitWidth.lp4 * 27;
  unitWidth.lp112 = unitWidth.lp4 * 28;
  unitWidth.lp116 = unitWidth.lp4 * 29;
  unitWidth.lp120 = unitWidth.lp4 * 30;
  unitWidth.lp124 = unitWidth.lp4 * 31;
  unitWidth.lp128 = unitWidth.lp4 * 32;
  unitWidth.lp132 = unitWidth.lp4 * 33;
  unitWidth.lp136 = unitWidth.lp4 * 34;
  unitWidth.lp140 = unitWidth.lp4 * 35;
  unitWidth.lp144 = unitWidth.lp4 * 36;
  unitWidth.lp148 = unitWidth.lp4 * 37;
  unitWidth.lp152 = unitWidth.lp4 * 38;
  unitWidth.lp156 = unitWidth.lp4 * 39;
  unitWidth.lp160 = unitWidth.lp4 * 40;
  unitWidth.lp164 = unitWidth.lp4 * 41;
  unitWidth.lp168 = unitWidth.lp4 * 42;
  unitWidth.lp172 = unitWidth.lp4 * 43;
  unitWidth.lp176 = unitWidth.lp4 * 44;
  unitWidth.lp180 = unitWidth.lp4 * 45;
  unitWidth.lp184 = unitWidth.lp4 * 46;
  unitWidth.lp188 = unitWidth.lp4 * 47;
  unitWidth.lp192 = unitWidth.lp4 * 48;
  unitWidth.lp196 = unitWidth.lp4 * 49;
  unitWidth.lp200 = unitWidth.lp4 * 50;
  unitWidth.lp204 = unitWidth.lp4 * 51;
  unitWidth.lp208 = unitWidth.lp4 * 52;
  unitWidth.lp212 = unitWidth.lp4 * 53;
  unitWidth.lp216 = unitWidth.lp4 * 54;
  unitWidth.lp220 = unitWidth.lp4 * 55;
  unitWidth.lp224 = unitWidth.lp4 * 56;
  unitWidth.lp228 = unitWidth.lp4 * 57;
  unitWidth.lp232 = unitWidth.lp4 * 58;
  unitWidth.lp236 = unitWidth.lp4 * 59;
  unitWidth.lp240 = unitWidth.lp4 * 60;
  unitWidth.lp244 = unitWidth.lp4 * 61;
  unitWidth.lp248 = unitWidth.lp4 * 62;
  unitWidth.lp252 = unitWidth.lp4 * 63;
  unitWidth.lp256 = unitWidth.lp4 * 64;
  unitWidth.lp260 = unitWidth.lp4 * 65;
  unitWidth.lp264 = unitWidth.lp4 * 66;
  unitWidth.lp268 = unitWidth.lp4 * 67;
  unitWidth.lp272 = unitWidth.lp4 * 68;
  unitWidth.lp276 = unitWidth.lp4 * 69;
  unitWidth.lp280 = unitWidth.lp4 * 70;
  unitWidth.lp284 = unitWidth.lp4 * 71;
  unitWidth.lp288 = unitWidth.lp4 * 72;
  unitWidth.lp292 = unitWidth.lp4 * 73;
  unitWidth.lp296 = unitWidth.lp4 * 74;
  unitWidth.lp300 = unitWidth.lp4 * 75;
  unitWidth.lp304 = unitWidth.lp4 * 76;
  unitWidth.lp308 = unitWidth.lp4 * 77;
  unitWidth.lp312 = unitWidth.lp4 * 78;
  unitWidth.lp316 = unitWidth.lp4 * 79;
  unitWidth.lp320 = unitWidth.lp4 * 80;
  unitWidth.lp324 = unitWidth.lp4 * 81;
  unitWidth.lp328 = unitWidth.lp4 * 82;
  unitWidth.lp332 = unitWidth.lp4 * 83;
  unitWidth.lp336 = unitWidth.lp4 * 84;
  unitWidth.lp340 = unitWidth.lp4 * 85;
  unitWidth.lp344 = unitWidth.lp4 * 86;
  unitWidth.lp348 = unitWidth.lp4 * 87;
  unitWidth.lp352 = unitWidth.lp4 * 88;
  unitWidth.lp356 = unitWidth.lp4 * 89;
  unitWidth.lp360 = unitWidth.lp4 * 90;
  unitWidth.lp364 = unitWidth.lp4 * 91;
  unitWidth.lp368 = unitWidth.lp4 * 92;
  unitWidth.lp372 = unitWidth.lp4 * 93;
  unitWidth.lp376 = unitWidth.lp4 * 94;
  unitWidth.lp380 = unitWidth.lp4 * 95;
  unitWidth.lp384 = unitWidth.lp4 * 96;
  unitWidth.lp388 = unitWidth.lp4 * 97;
  unitWidth.lp392 = unitWidth.lp4 * 98;
  unitWidth.lp396 = unitWidth.lp4 * 99;
  unitWidth.lp400 = unitWidth.lp4 * 100;
  unitWidth.lp404 = unitWidth.lp4 * 101;
  unitWidth.lp408 = unitWidth.lp4 * 102;
  unitWidth.lp412 = unitWidth.lp4 * 103;
  unitWidth.lp416 = unitWidth.lp4 * 104;
  unitWidth.lp420 = unitWidth.lp4 * 105;
  unitWidth.lp424 = unitWidth.lp4 * 106;
  unitWidth.lp428 = unitWidth.lp4 * 107;
  unitWidth.lp432 = unitWidth.lp4 * 108;
  unitWidth.lp436 = unitWidth.lp4 * 109;
  unitWidth.lp440 = unitWidth.lp4 * 110;
  unitWidth.lp444 = unitWidth.lp4 * 111;
  unitWidth.lp448 = unitWidth.lp4 * 112;
  unitWidth.lp452 = unitWidth.lp4 * 113;
  unitWidth.lp456 = unitWidth.lp4 * 114;
  unitWidth.lp460 = unitWidth.lp4 * 115;
  unitWidth.lp464 = unitWidth.lp4 * 116;
  unitWidth.lp468 = unitWidth.lp4 * 117;
  unitWidth.lp472 = unitWidth.lp4 * 118;
  unitWidth.lp476 = unitWidth.lp4 * 119;
  unitWidth.lp480 = unitWidth.lp4 * 120;
  unitWidth.lp484 = unitWidth.lp4 * 121;
  unitWidth.lp488 = unitWidth.lp4 * 122;
  unitWidth.lp492 = unitWidth.lp4 * 123;
  unitWidth.lp496 = unitWidth.lp4 * 124;
  unitWidth.lp500 = unitWidth.lp4 * 125;

  unitHeight.lp8 = unitHeight.lp4 * 2;
  unitHeight.lp12 = unitHeight.lp4 * 3;
  unitHeight.lp16 = unitHeight.lp4 * 4;
  unitHeight.lp20 = unitHeight.lp4 * 5;
  unitHeight.lp24 = unitHeight.lp4 * 6;
  unitHeight.lp28 = unitHeight.lp4 * 7;
  unitHeight.lp32 = unitHeight.lp4 * 8;
  unitHeight.lp36 = unitHeight.lp4 * 9;
  unitHeight.lp40 = unitHeight.lp4 * 10;
  unitHeight.lp44 = unitHeight.lp4 * 11;
  unitHeight.lp48 = unitHeight.lp4 * 12;
  unitHeight.lp52 = unitHeight.lp4 * 13;
  unitHeight.lp56 = unitHeight.lp4 * 14;
  unitHeight.lp60 = unitHeight.lp4 * 15;
  unitHeight.lp64 = unitHeight.lp4 * 16;
  unitHeight.lp68 = unitHeight.lp4 * 17;
  unitHeight.lp72 = unitHeight.lp4 * 18;
  unitHeight.lp76 = unitHeight.lp4 * 19;
  unitHeight.lp80 = unitHeight.lp4 * 20;
  unitHeight.lp84 = unitHeight.lp4 * 21;
  unitHeight.lp88 = unitHeight.lp4 * 22;
  unitHeight.lp92 = unitHeight.lp4 * 23;
  unitHeight.lp96 = unitHeight.lp4 * 24;
  unitHeight.lp100 = unitHeight.lp4 * 25;
  unitHeight.lp104 = unitHeight.lp4 * 26;
  unitHeight.lp108 = unitHeight.lp4 * 27;
  unitHeight.lp112 = unitHeight.lp4 * 28;
  unitHeight.lp116 = unitHeight.lp4 * 29;
  unitHeight.lp120 = unitHeight.lp4 * 30;
  unitHeight.lp124 = unitHeight.lp4 * 31;
  unitHeight.lp128 = unitHeight.lp4 * 32;
  unitHeight.lp132 = unitHeight.lp4 * 33;
  unitHeight.lp136 = unitHeight.lp4 * 34;
  unitHeight.lp140 = unitHeight.lp4 * 35;
  unitHeight.lp144 = unitHeight.lp4 * 36;
  unitHeight.lp148 = unitHeight.lp4 * 37;
  unitHeight.lp152 = unitHeight.lp4 * 38;
  unitHeight.lp156 = unitHeight.lp4 * 39;
  unitHeight.lp160 = unitHeight.lp4 * 40;
  unitHeight.lp164 = unitHeight.lp4 * 41;
  unitHeight.lp168 = unitHeight.lp4 * 42;
  unitHeight.lp172 = unitHeight.lp4 * 43;
  unitHeight.lp176 = unitHeight.lp4 * 44;
  unitHeight.lp180 = unitHeight.lp4 * 45;
  unitHeight.lp184 = unitHeight.lp4 * 46;
  unitHeight.lp188 = unitHeight.lp4 * 47;
  unitHeight.lp192 = unitHeight.lp4 * 48;
  unitHeight.lp196 = unitHeight.lp4 * 49;
  unitHeight.lp200 = unitHeight.lp4 * 50;
  unitHeight.lp204 = unitHeight.lp4 * 51;
  unitHeight.lp208 = unitHeight.lp4 * 52;
  unitHeight.lp212 = unitHeight.lp4 * 53;
  unitHeight.lp216 = unitHeight.lp4 * 54;
  unitHeight.lp220 = unitHeight.lp4 * 55;
  unitHeight.lp224 = unitHeight.lp4 * 56;
  unitHeight.lp228 = unitHeight.lp4 * 57;
  unitHeight.lp232 = unitHeight.lp4 * 58;
  unitHeight.lp236 = unitHeight.lp4 * 59;
  unitHeight.lp240 = unitHeight.lp4 * 60;
  unitHeight.lp244 = unitHeight.lp4 * 61;
  unitHeight.lp248 = unitHeight.lp4 * 62;
  unitHeight.lp252 = unitHeight.lp4 * 63;
  unitHeight.lp256 = unitHeight.lp4 * 64;
  unitHeight.lp260 = unitHeight.lp4 * 65;
  unitHeight.lp264 = unitHeight.lp4 * 66;
  unitHeight.lp268 = unitHeight.lp4 * 67;
  unitHeight.lp272 = unitHeight.lp4 * 68;
  unitHeight.lp276 = unitHeight.lp4 * 69;
  unitHeight.lp280 = unitHeight.lp4 * 70;
  unitHeight.lp284 = unitHeight.lp4 * 71;
  unitHeight.lp288 = unitHeight.lp4 * 72;
  unitHeight.lp292 = unitHeight.lp4 * 73;
  unitHeight.lp296 = unitHeight.lp4 * 74;
  unitHeight.lp300 = unitHeight.lp4 * 75;
  unitHeight.lp304 = unitHeight.lp4 * 76;
  unitHeight.lp308 = unitHeight.lp4 * 77;
  unitHeight.lp312 = unitHeight.lp4 * 78;
  unitHeight.lp316 = unitHeight.lp4 * 79;
  unitHeight.lp320 = unitHeight.lp4 * 80;
  unitHeight.lp324 = unitHeight.lp4 * 81;
  unitHeight.lp328 = unitHeight.lp4 * 82;
  unitHeight.lp332 = unitHeight.lp4 * 83;
  unitHeight.lp336 = unitHeight.lp4 * 84;
  unitHeight.lp340 = unitHeight.lp4 * 85;
  unitHeight.lp344 = unitHeight.lp4 * 86;
  unitHeight.lp348 = unitHeight.lp4 * 87;
  unitHeight.lp352 = unitHeight.lp4 * 88;
  unitHeight.lp356 = unitHeight.lp4 * 89;
  unitHeight.lp360 = unitHeight.lp4 * 90;
  unitHeight.lp364 = unitHeight.lp4 * 91;
  unitHeight.lp368 = unitHeight.lp4 * 92;
  unitHeight.lp372 = unitHeight.lp4 * 93;
  unitHeight.lp376 = unitHeight.lp4 * 94;
  unitHeight.lp380 = unitHeight.lp4 * 95;
  unitHeight.lp384 = unitHeight.lp4 * 96;
  unitHeight.lp388 = unitHeight.lp4 * 97;
  unitHeight.lp392 = unitHeight.lp4 * 98;
  unitHeight.lp396 = unitHeight.lp4 * 99;
  unitHeight.lp400 = unitHeight.lp4 * 100;
  unitHeight.lp404 = unitHeight.lp4 * 101;
  unitHeight.lp408 = unitHeight.lp4 * 102;
  unitHeight.lp412 = unitHeight.lp4 * 103;
  unitHeight.lp416 = unitHeight.lp4 * 104;
  unitHeight.lp420 = unitHeight.lp4 * 105;
  unitHeight.lp424 = unitHeight.lp4 * 106;
  unitHeight.lp428 = unitHeight.lp4 * 107;
  unitHeight.lp432 = unitHeight.lp4 * 108;
  unitHeight.lp436 = unitHeight.lp4 * 109;
  unitHeight.lp440 = unitHeight.lp4 * 110;
  unitHeight.lp444 = unitHeight.lp4 * 111;
  unitHeight.lp448 = unitHeight.lp4 * 112;
  unitHeight.lp452 = unitHeight.lp4 * 113;
  unitHeight.lp456 = unitHeight.lp4 * 114;
  unitHeight.lp460 = unitHeight.lp4 * 115;
  unitHeight.lp464 = unitHeight.lp4 * 116;
  unitHeight.lp468 = unitHeight.lp4 * 117;
  unitHeight.lp472 = unitHeight.lp4 * 118;
  unitHeight.lp476 = unitHeight.lp4 * 119;
  unitHeight.lp480 = unitHeight.lp4 * 120;
  unitHeight.lp484 = unitHeight.lp4 * 121;
  unitHeight.lp488 = unitHeight.lp4 * 122;
  unitHeight.lp492 = unitHeight.lp4 * 123;
  unitHeight.lp496 = unitHeight.lp4 * 124;
  unitHeight.lp500 = unitHeight.lp4 * 125;
}