styleSheet static method

MarkdownStyleSheet styleSheet(
  1. ThemeData theme
)

The shared MarkdownStyleSheet matching the app theme.

Implementation

static MarkdownStyleSheet styleSheet(ThemeData theme) {
  return MarkdownStyleSheet.fromTheme(theme).copyWith(
    p: theme.textTheme.bodyMedium,
    code: theme.textTheme.bodySmall?.copyWith(
      backgroundColor: theme.colorScheme.surface,
      fontFamily: 'monospace',
    ),
    // Custom HighlightedCodeBlockBuilder handles its own background,
    // border-radius, and clipping. Empty decoration prevents the
    // double-wrapping that flutter_markdown's outer Container would
    // otherwise add.
    codeblockDecoration: const BoxDecoration(),
    blockquote: theme.textTheme.bodyMedium?.copyWith(
      color: theme.colorScheme.onSurfaceVariant,
    ),
    blockquoteDecoration: BoxDecoration(
      color: theme.colorScheme.surface,
      border: Border(
        left: BorderSide(
          color: DuTaToTheme.primary.withValues(alpha: 0.6),
          width: 3,
        ),
      ),
    ),
    blockquotePadding: const EdgeInsets.fromLTRB(12, 8, 12, 8),
  );
}