resolveTextStyle static method
Implementation
static TextStyle resolveTextStyle(Map<String, dynamic>? style, BuildContext context) {
if (style == null) return Theme.of(context).textTheme.bodyMedium ?? const TextStyle();
double? fontSize;
FontWeight? fontWeight;
Color? color = parseColor(style['color']);
if (style.containsKey('fontSize')) {
final fs = style['fontSize'];
if (fs is num) fontSize = fs.toDouble();
}
if (style.containsKey('fontWeight')) {
final fw = style['fontWeight'].toString();
if (fw == 'bold' || fw == '700') fontWeight = FontWeight.bold;
if (fw == '600') fontWeight = FontWeight.w600;
if (fw == '500') fontWeight = FontWeight.w500;
if (fw == 'normal' || fw == '400') fontWeight = FontWeight.normal;
}
return TextStyle(
fontSize: fontSize,
fontWeight: fontWeight,
color: color,
);
}