validateLineHeight function
Validates line height within configured bounds.
Implementation
double validateLineHeight(
double? height, {
double defaultValue = 1.2,
bool? enableSecurity,
}) {
final shouldValidate = enableSecurity ?? TextSecurityConfig.enforceValidation;
if (height == null) return defaultValue;
if (!shouldValidate) return height;
if (height > TextSecurityConfig.maxLineHeight) {
if (TextSecurityConfig.enableSecurityLogging) {
debugPrint(
'[SAC Text Security] Line height $height above max ${TextSecurityConfig.maxLineHeight}',
);
}
return TextSecurityConfig.maxLineHeight;
}
if (height < TextSecurityConfig.minLineHeight) {
if (TextSecurityConfig.enableSecurityLogging) {
debugPrint(
'[SAC Text Security] Line height $height below min ${TextSecurityConfig.minLineHeight}',
);
}
return TextSecurityConfig.minLineHeight;
}
return height;
}