of static method

SizeHelper of(
  1. BuildContext context, {
  2. bool printScreenInfo = false,
})

Implementation

static SizeHelper of(BuildContext context, {bool printScreenInfo = false}) {
  final size = MediaQuery.of(context).size;

  final width = size.width;
  final height = size.height;

  willDependOnOrientation ??= _determineIfWillDependOnOrientation();

  final currentOrientation = willDependOnOrientation == true
      ? width > height
          ? Orientation.landscape
          : Orientation.portrait
      : Orientation.portrait;

  final currentLength = willDependOnOrientation == true
      ? currentOrientation == Orientation.portrait
          ? width
          : height
      : width;

  return SizeHelper._internal(
    currentLength,
    size,
    currentOrientation,
    printScreenInfo,
  );
}