titleStyle static method

TextStyle titleStyle({
  1. BuildContext? context,
  2. TextSizeEnum? size,
  3. Color? color,
  4. FontWeight? fontWeight,
})

标题样式(大标题/导航标题)

size - 文本尺寸(可选,如果提供则覆盖配置中的尺寸) color - 文本颜色(可选,如果提供则覆盖配置中的颜色) fontWeight - 字体粗细(可选,如果提供则覆盖配置中的粗细) context - BuildContext,用于获取当前主题和屏幕方向(必需)

Implementation

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

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

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