validateTitleFontSize function
Validate title font size is within bounds.
Pass enableSecurity to override global setting, or leave null to use global.
Implementation
double validateTitleFontSize(
double? value, {
required double defaultValue,
bool? enableSecurity,
}) {
if (value == null) return defaultValue;
final shouldValidate =
enableSecurity ?? AppBarSecurityConfig.enforceValidation;
if (!shouldValidate) return value;
if (value < AppBarSecurityConfig.minTitleFontSize) {
_logAppBarSecurity(
'Title font size $value below minimum ${AppBarSecurityConfig.minTitleFontSize}',
);
return AppBarSecurityConfig.minTitleFontSize;
}
if (value > AppBarSecurityConfig.maxTitleFontSize) {
_logAppBarSecurity(
'Title font size $value above maximum ${AppBarSecurityConfig.maxTitleFontSize}',
);
return AppBarSecurityConfig.maxTitleFontSize;
}
return value;
}