config static method
void
config({
- double? maxSizeMultiplier,
- double? baseScreenWidth,
- required bool responsiveFonts,
- DefaultFontWeight? defaultFontWeight,
- Color? defaultColor,
Implementation
static void config({
double? maxSizeMultiplier,
double? baseScreenWidth,
required bool responsiveFonts,
DefaultFontWeight? defaultFontWeight,
Color? defaultColor,
}) {
_responsiveFonts = responsiveFonts;
if (maxSizeMultiplier != null) {
_maxSizeMultiplier = maxSizeMultiplier;
}
if (baseScreenWidth != null) {
_baseScreenWidth = baseScreenWidth;
}
if (defaultFontWeight != null) {
_defaultFontWeight = defaultFontWeight;
}
if (defaultColor != null) {
_defaultColor = defaultColor;
}
_isInitialized = true;
// Debug logging - only once
if (kDebugMode && !_configLogged) {
_configLogged = true;
debugPrint('\x1B[36m=== SimplifiedTextWidgetConfig ===\x1B[0m');
// Responsive Fonts
String fontColor = _responsiveFonts ? '\x1B[92m' : '\x1B[91m';
debugPrint(
'$fontColor Responsive Fonts: ${_responsiveFonts ? "Enabled" : "Disabled"}\x1B[0m');
// Default Font Weight
debugPrint(
'\x1B[35m Default Font Weight: ${_defaultFontWeight.label}\x1B[0m');
// Optional values
if (maxSizeMultiplier != null) {
debugPrint(
'\x1B[38;5;208m Max Size Multiplier: $_maxSizeMultiplier\x1B[0m');
}
if (baseScreenWidth != null) {
debugPrint('\x1B[34m Base Screen Width: $_baseScreenWidth\x1B[0m');
}
// Default Color - with color preview and hex
String colorName = getColorName(_defaultColor);
// Use the actual color for the text (ANSI true color)
int r = (_defaultColor.r * 255).round();
int g = (_defaultColor.g * 255).round();
int b = (_defaultColor.b * 255).round();
String colorPreview = '\x1B[38;2;${r};${g};${b}m';
debugPrint('$colorPreview Default Color: $colorName\x1B[0m');
debugPrint('\x1B[36m==================================\x1B[0m');
}
}