setSp method

  1. @override
double setSp(
  1. num fontSize, {
  2. bool? allowFontScaling,
})
override

fontSize 传入fontSize 返回 适配后的fontSize

Implementation

@override
double setSp(num fontSize, {bool? allowFontScaling}) {
  if (allowFontScaling == null) {
    if (this.allowFontScaling == false)
      return fontSize *
          min(screenWidth! / this.width, screenHeight! / this.height);
    return fontSize *
        min(screenWidth! / this.width, screenHeight! / this.height) *
        textScaleFactor!;
  }
  if (allowFontScaling == false)
    return fontSize *
        min(screenWidth! / this.width, screenHeight! / this.height);
  return fontSize *
      min(screenWidth! / this.width, screenHeight! / this.height) *
      textScaleFactor!;
}