validateTextFieldHeight function
Validates height within configured bounds.
Implementation
double validateTextFieldHeight(
double? height, {
double? defaultValue,
bool? enableSecurity,
}) {
final shouldValidate =
enableSecurity ?? TextFieldSecurityConfig.enforceValidation;
if (height == null) return defaultValue ?? 56.0;
if (!shouldValidate) return height;
if (height > TextFieldSecurityConfig.maxHeight) {
if (TextFieldSecurityConfig.enableSecurityLogging) {
debugPrint(
'[SAC TextField Security] Height $height above max ${TextFieldSecurityConfig.maxHeight}',
);
}
return TextFieldSecurityConfig.maxHeight;
}
if (height < TextFieldSecurityConfig.minHeight) {
if (TextFieldSecurityConfig.enableSecurityLogging) {
debugPrint(
'[SAC TextField Security] Height $height below min ${TextFieldSecurityConfig.minHeight}',
);
}
return TextFieldSecurityConfig.minHeight;
}
return height;
}