validateTextFieldBorderWidth function
Validates border width within configured bounds.
Implementation
double validateTextFieldBorderWidth(
double? width, {
double defaultValue = 1.0,
bool? enableSecurity,
}) {
final shouldValidate =
enableSecurity ?? TextFieldSecurityConfig.enforceValidation;
if (width == null) return defaultValue;
if (!shouldValidate) return width;
if (width < 0) {
if (TextFieldSecurityConfig.enableSecurityLogging) {
debugPrint(
'[SAC TextField Security] Border width $width is negative, using 0',
);
}
return 0;
}
if (width > TextFieldSecurityConfig.maxBorderWidth) {
if (TextFieldSecurityConfig.enableSecurityLogging) {
debugPrint(
'[SAC TextField Security] Border width $width above max ${TextFieldSecurityConfig.maxBorderWidth}',
);
}
return TextFieldSecurityConfig.maxBorderWidth;
}
return width;
}