GptMarkdownThemeData constructor

GptMarkdownThemeData({
  1. required Brightness brightness,
  2. Color? highlightColor,
  3. TextStyle? h1,
  4. TextStyle? h2,
  5. TextStyle? h3,
  6. TextStyle? h4,
  7. TextStyle? h5,
  8. TextStyle? h6,
  9. double? hrLineThickness,
  10. Color? hrLineColor,
  11. Color? linkColor,
  12. Color? linkHoverColor,
})

A factory constructor for GptMarkdownThemeData.

Implementation

factory GptMarkdownThemeData({
  required Brightness brightness,
  Color? highlightColor,
  TextStyle? h1,
  TextStyle? h2,
  TextStyle? h3,
  TextStyle? h4,
  TextStyle? h5,
  TextStyle? h6,
  double? hrLineThickness,
  Color? hrLineColor,
  Color? linkColor,
  Color? linkHoverColor,
}) {
  ThemeData themeData = switch (brightness) {
    Brightness.light => ThemeData.light(),
    Brightness.dark => ThemeData.dark(),
  };
  final typography = Typography.tall2021.copyWith(
    displayLarge: Typography.tall2021.displayLarge?.copyWith(inherit: true),
    displayMedium: Typography.tall2021.displayMedium?.copyWith(inherit: true),
    displaySmall: Typography.tall2021.displaySmall?.copyWith(inherit: true),
    headlineLarge: Typography.tall2021.headlineLarge?.copyWith(inherit: true),
    headlineMedium: Typography.tall2021.headlineMedium?.copyWith(
      inherit: true,
    ),
    headlineSmall: Typography.tall2021.headlineSmall?.copyWith(inherit: true),
    titleLarge: Typography.tall2021.titleLarge?.copyWith(inherit: true),
    titleMedium: Typography.tall2021.titleMedium?.copyWith(inherit: true),
    titleSmall: Typography.tall2021.titleSmall?.copyWith(inherit: true),
    bodyLarge: Typography.tall2021.bodyLarge?.copyWith(inherit: true),
    bodyMedium: Typography.tall2021.bodyMedium?.copyWith(inherit: true),
    bodySmall: Typography.tall2021.bodySmall?.copyWith(inherit: true),
    labelLarge: Typography.tall2021.labelLarge?.copyWith(inherit: true),
    labelMedium: Typography.tall2021.labelMedium?.copyWith(inherit: true),
    labelSmall: Typography.tall2021.labelSmall?.copyWith(inherit: true),
  );
  themeData = themeData.copyWith(textTheme: typography);
  TextTheme textTheme = themeData.textTheme;
  return GptMarkdownThemeData._fromTheme(themeData, textTheme).copyWith(
    highlightColor: highlightColor,
    h1: h1,
    h2: h2,
    h3: h3,
    h4: h4,
    h5: h5,
    h6: h6,
    hrLineThickness: hrLineThickness,
    hrLineColor: hrLineColor,
    linkColor: linkColor,
    linkHoverColor: linkHoverColor,
  );
}