responsiveFont static method
This class gives you a reasonable font Size Use this class with fontSize and fontHeight property of TextStyle
Implementation
static double responsiveFont({
required double fontSize,
double? maxFontSize,
}) {
final orientation = _orientation;
if (orientation == Orientation.portrait) {
final _calculatedFontSize =
_screenHeight * fontSize / _designedDeviceHeight;
if (maxFontSize == null) {
if (_calculatedFontSize <= fontSize) {
return _calculatedFontSize;
} else {
return fontSize;
}
} else {
return _comparator(
value: _calculatedFontSize,
maxValue: maxFontSize,
);
}
} else {
final _calculatedFontSize =
_screenHeight * fontSize / _designedDeviceWidth;
if (maxFontSize == null) {
if (_calculatedFontSize <= fontSize) {
return _calculatedFontSize;
} else {
return fontSize;
}
} else {
return _comparator(
value: _calculatedFontSize,
maxValue: maxFontSize,
);
}
}
}