getTextStyle static method
TextStyle?
getTextStyle(
- List<
PaywallAsset> assets, - String? fontId,
- String? colorId, {
- bool isRTL = false,
- BuildContext? context,
- String? customFontFamily,
Implementation
static TextStyle? getTextStyle(
List<PaywallAsset> assets, String? fontId, String? colorId,
{bool isRTL = false, BuildContext? context, String? customFontFamily}) {
if ((fontId == null || fontId.isEmpty) &&
(colorId == null || colorId.isEmpty)) return null;
final Color? color = getPaywallAssetColor(assets, colorId);
final double originalFontSize =
getPaywallAssetFontSize(assets, fontId) ?? 14;
// Use responsive font size if context is provided
double? finalFontSize = originalFontSize;
if (context != null) {
finalFontSize = ResponsiveFontHelper.getResponsiveFontSize(
context: context,
baseSize: originalFontSize,
minSize: originalFontSize * 0.7,
maxSize: originalFontSize * 1.5,
);
}
return TextStyle(
color: color ?? Colors.black,
fontSize: finalFontSize,
fontFamily: customFontFamily ?? (isRTL ? 'Vazirmatn' : null),
height: 1.7 // Use custom font family or Persian font for RTL
);
}