validateSize function
Implementation
double validateSize(
double? value, {
required double defaultValue,
double? min,
double? max,
bool? enableSecurity,
}) {
if (value == null) return defaultValue;
final shouldValidate =
enableSecurity ?? ButtonSecurityConfig.enforceValidation;
if (!shouldValidate) return value;
final effectiveMin = min ?? ButtonSecurityConfig.minButtonSize;
final effectiveMax = max ?? ButtonSecurityConfig.maxButtonSize;
if (value < effectiveMin) {
_logSecurity('Size $value below minimum $effectiveMin, using minimum');
return effectiveMin;
}
if (value > effectiveMax) {
_logSecurity('Size $value above maximum $effectiveMax, using maximum');
return effectiveMax;
}
return value;
}