contentStyle static method

TextStyle contentStyle({
  1. BuildContext? context,
  2. TextSizeEnum? size,
  3. Color? color,
})

正文样式

size - 文本尺寸(可选) color - 文本颜色(可选) context - BuildContext,用于获取当前主题和屏幕方向(必需)

Implementation

static TextStyle contentStyle({
  BuildContext? context,
  TextSizeEnum? size,
  Color? color,
}) {
  // 如果没有提供 context,使用旧的方式(向后兼容)
  if (context == null) {
    return TextStyle(
      fontSize: size?.value ?? TextSizeEnum.medium.value,
      fontWeight: FontWeight.w400,
      color: color ?? Colors.black,
    );
  }

  // 使用新的样式管理器
  final styleManager = FormStyleManager();
  final styleConfig = styleManager.getEffectiveStyleConfig(context);
  final colorScheme = styleManager.getEffectiveColorScheme(context);

  return TextStyle(
    fontSize: size?.value ?? styleConfig.contentStyle.fontSize,
    fontWeight: styleConfig.contentStyle.fontWeight,
    color: color ?? styleConfig.contentStyle.color ?? colorScheme.contentColor,
    fontStyle: styleConfig.contentStyle.fontStyle,
    letterSpacing: styleConfig.contentStyle.letterSpacing,
    height: styleConfig.contentStyle.height,
  );
}