init method

void init(
  1. BuildContext context
)

Implementation

void init(BuildContext context) {
  _mediaQueryData = MediaQuery.of(context);
  screenWidth = _mediaQueryData.size.width;
  screenHeight = _mediaQueryData.size.height;
  double _safeAreaWidth =
      _mediaQueryData.padding.left + _mediaQueryData.padding.right;
  double _safeAreaHeight =
      _mediaQueryData.padding.top + _mediaQueryData.padding.bottom;
  safeWidth = (screenWidth - _safeAreaWidth);
  safeHeight = (screenHeight - _safeAreaHeight);

  //Scale factor for responsive UI
  scaleFactorHeight = (safeHeight / 820);
  if (scaleFactorHeight < 1) {
    double diff = (1 - scaleFactorHeight) * (1 - scaleFactorHeight);
    scaleFactorHeight += diff;
  }
  scaleFactorWidth = safeWidth / 392;
  if (scaleFactorWidth < 1) {
    double diff = (1 - scaleFactorWidth) * (1 - scaleFactorWidth);
    scaleFactorWidth += diff;
  }

  //Custom sizes
  x0 = 0;
  x2 = scaleFactorHeight * 2;
  x3 = scaleFactorHeight * 3;
  x4 = scaleFactorHeight * 4;
  x5 = scaleFactorHeight * 5;
  x6 = scaleFactorHeight * 6;
  x7 = scaleFactorHeight * 7;
  x8 = scaleFactorHeight * 8;
  x10 = scaleFactorHeight * 10;
  x12 = scaleFactorHeight * 12;
  x14 = scaleFactorHeight * 14;
  x15 = scaleFactorHeight * 15;
  x16 = scaleFactorHeight * 16;
  x17 = scaleFactorHeight * 17;
  x18 = scaleFactorHeight * 18;
  x19 = scaleFactorHeight * 19;
  x20 = scaleFactorHeight * 20;
  x22 = scaleFactorHeight * 22;
  x23 = scaleFactorHeight * 23;
  x24 = scaleFactorHeight * 24;
  x25 = scaleFactorHeight * 25;
  x26 = scaleFactorHeight * 26;
  x28 = scaleFactorHeight * 28;
  x30 = scaleFactorHeight * 30;
  x32 = scaleFactorHeight * 32;
  x34 = scaleFactorHeight * 34;
  x35 = scaleFactorHeight * 35;
  x36 = scaleFactorHeight * 36;
  x38 = scaleFactorHeight * 38;
  x40 = scaleFactorHeight * 40;
  x42 = scaleFactorHeight * 42;
  x44 = scaleFactorHeight * 44;
  x48 = scaleFactorHeight * 48;
  x50 = scaleFactorHeight * 50;
  x52 = scaleFactorHeight * 52;
  x54 = scaleFactorHeight * 54;
  x56 = scaleFactorHeight * 56;
  x60 = scaleFactorHeight * 60;
  x64 = scaleFactorHeight * 64;
  x68 = scaleFactorHeight * 68;
  x72 = scaleFactorHeight * 72;
  x76 = scaleFactorHeight * 76;
  x80 = scaleFactorHeight * 80;
  x90 = scaleFactorHeight * 90;
  x96 = scaleFactorHeight * 96;
  x100 = scaleFactorHeight * 100;
  x110 = scaleFactorHeight * 110;
  x120 = scaleFactorHeight * 120;
  x140 = scaleFactorHeight * 140;
  x160 = scaleFactorHeight * 160;
  x180 = scaleFactorHeight * 180;
  x200 = scaleFactorHeight * 200;
  x220 = scaleFactorHeight * 220;
  x225 = scaleFactorHeight * 225;
  x230 = scaleFactorHeight * 230;
  x240 = scaleFactorHeight * 240;
  x245 = scaleFactorHeight * 245;
  x250 = scaleFactorHeight * 250;
  x260 = scaleFactorHeight * 260;
  x270 = scaleFactorHeight * 270;
  x280 = scaleFactorHeight * 280;
  x285 = scaleFactorHeight * 285;
  x290 = scaleFactorHeight * 290;
  x300 = scaleFactorHeight * 300;
  x310 = scaleFactorHeight * 310;
  x320 = scaleFactorHeight * 320;
  x330 = scaleFactorHeight * 330;
  x340 = scaleFactorHeight * 340;
  x350 = scaleFactorHeight * 350;
  x360 = scaleFactorHeight * 360;
  x370 = scaleFactorHeight * 370;
  x380 = scaleFactorHeight * 380;
  x390 = scaleFactorHeight * 390;
  x400 = scaleFactorHeight * 400;
  x410 = scaleFactorHeight * 410;
  x420 = scaleFactorHeight * 420;
  x430 = scaleFactorHeight * 430;
  x440 = scaleFactorHeight * 440;
  x450 = scaleFactorHeight * 450;
}