convertFormFactor static method

AFFormFactor convertFormFactor(
  1. Size size
)

Implementation

static AFFormFactor convertFormFactor(Size size) {
  // normalize to portrait
  final width = size.width > size.height ? size.height : size.width;
  final height = size.width > size.height ? size.width : size.height;

  if(width >= AFFormFactorSize.sizeTabletLarge.width && height >= AFFormFactorSize.sizeTabletLarge.height) {
    return AFFormFactor.largeTablet;
  } else if(width >= AFFormFactorSize.sizeTabletStandard.width && height >= AFFormFactorSize.sizeTabletStandard.height) {
    return AFFormFactor.standardTablet;
  } else if(width >= AFFormFactorSize.sizeTabletSmall.width && height >= AFFormFactorSize.sizeTabletSmall.height) {
    return AFFormFactor.smallTablet;
  } else if(width >= AFFormFactorSize.sizePhoneLarge.width && height >= AFFormFactorSize.sizePhoneLarge.height) {
    return AFFormFactor.largePhone;
  } else if(width >= AFFormFactorSize.sizePhoneStandard.width && height >= AFFormFactorSize.sizePhoneStandard.height) {
    return AFFormFactor.standardPhone;
  }
  return AFFormFactor.smallPhone;
}