setFontSize method

double setFontSize(
  1. double fontSize
)

setFontSize uses its argument fontSize to calculate the initial text size in pixels and from that the package can deal with all the calculation. setFontSize {@tool sample}

Text(
   'This is a Test Text',
    style: TextStyle(
            fontSize: response.setFontSize(24),
            fontWeight: FontWeight.bold,
         ), //TextStyle
      ) //Text

{@end-tool}

fontSize is the text size which you want it to be the same across any screen size.

Implementation

double setFontSize(double fontSize) {
  if (_fixedHeightFactor == null || _blockHeight == null || _originalWidth == null || _screenWidth == null)
    throw DidNotCallInit();
  double _heightCorrectionFactor = _fixedHeightFactor!;
  //if the original device is Tablet
  if (_originalWidth! > _screenWidth!) {
    _heightCorrectionFactor /= 1.2;
  }
  return ((fontSize / _heightCorrectionFactor) * _blockHeight!);
}