getPadding method

EdgeInsetsGeometry getPadding(
  1. String? data,
  2. double fontSize,
  3. double height
)

获取padding

Implementation

EdgeInsetsGeometry getPadding(String? data, double fontSize, double height) {
  var paddingFont = fontSize * paddingRate;
  var paddingLeading;
  if (height < heightRate) {
    paddingLeading = 0;
  } else {
    if (PlatformUtil.isIOS || PlatformUtil.isAndroid) {
      paddingLeading = (height * 0.5 - paddingExtraRate) * fontSize;
    } else {
      paddingLeading = 0;
    }
  }
  var paddingTop = paddingFont + paddingLeading;
  if (paddingTop < 0) {
    paddingTop = 0;
  }
  return EdgeInsets.only(top: paddingTop);
}