getTextStyle method
Implementation
TextStyle? getTextStyle(String? fontId, String? colorId,
{String? customFontFamily}) {
if (fontId == null && colorId == null) return null;
final fontAsset = _assetsMap[fontId];
final colorAsset = _assetsMap[colorId];
Color? color;
if (colorAsset?.type == 'color') {
final double opacity = colorAsset?.opacity?.toDouble() ?? 1.0;
color = _toColor(colorAsset?.value, opacity);
}
double? fontSize;
if (fontAsset?.type == 'font') {
fontSize = double.tryParse(fontAsset?.size ?? '');
}
if (color == null && fontSize == null) return null;
return TextStyle(
color: color,
fontSize: fontSize,
fontFamily: customFontFamily,
// FontWeight, FontStyle و موارد دیگر را میتوانید اضافه کنید اگر در JSON باشند.
);
}