of static method

A method to get the GptMarkdownThemeData from the BuildContext.

Implementation

static GptMarkdownThemeData of(BuildContext context) {
  var theme = Theme.of(context);
  final provider =
      context.dependOnInheritedWidgetOfExactType<GptMarkdownTheme>();
  if (provider != null) {
    return provider.gptThemeData;
  }
  final themeData = theme.extension<GptMarkdownThemeData>();
  if (themeData != null) {
    return themeData;
  }
  return GptMarkdownThemeData._fromTheme(theme, theme.textTheme);
}