viewMarkdown method
Implementation
Widget viewMarkdown(String data) {
Color bg = isDarkTheme
? lighten(backgroundColor ?? Rixa.appColors.backgroundColor, .2)
: darken(backgroundColor ?? Rixa.appColors.backgroundColor, .1);
return markdown_widget.MarkdownWidget(
data: data,
padding: padding,
selectable: selectable,
shrinkWrap: shrinkWrap,
markdownGeneratorConfig: markdown_widget.MarkdownGeneratorConfig(
generators: [
videoGeneratorWithTag,
if (latexConfig != null)
markdown_widget.SpanNodeGeneratorWithTag(
tag: 'latex',
generator: (e, config, visitor) => LatexNode(
e.attributes, e.textContent, config,
textStyle: latexConfig?.textStyle))
],
inlineSyntaxList: [if (latexConfig != null) LatexSyntax()],
textGenerator: (node, config, visitor) =>
CustomTextNode(node.textContent, config, visitor),
),
config: markdown_widget.MarkdownConfig(
configs: [
markdown_widget.PreConfig(
textStyle: codeConfig.textStyle,
padding: codeConfig.padding,
decoration: codeConfig.decoration ??
BoxDecoration(
color: bg,
borderRadius: const BorderRadius.all(Radius.circular(8.0)),
),
margin: codeConfig.margin,
theme: isDarkTheme ? a11yDarkTheme : a11yLightTheme,
wrapper: (child, code) => codeConfig.wrapper != null
? Padding(
padding: codePadding,
child: codeConfig.wrapper!(child, code),
)
: Padding(
padding: codePadding,
child: CodeWrapperWidget(
text: code,
child: child,
),
),
language: codeConfig.language),
markdown_widget.PConfig(textStyle: textConfig.p),
markdown_widget.H1Config(style: textConfig.h1),
markdown_widget.H2Config(style: textConfig.h2),
markdown_widget.H3Config(style: textConfig.h3),
markdown_widget.H4Config(style: textConfig.h4),
markdown_widget.H5Config(style: textConfig.h5),
markdown_widget.H6Config(style: textConfig.h6),
if (imageConfig != null)
markdown_widget.ImgConfig(
builder: imageConfig!.builder,
errorBuilder: imageConfig!.errorBuilder,
),
markdown_widget.LinkConfig(
style: linkConfig.textStyle, onTap: linkConfig.onTap),
markdown_widget.CodeConfig(
style: TextStyle(
color: codeConfig.textStyle.color,
fontSize: codeConfig.textStyle.fontSize,
fontWeight: codeConfig.textStyle.fontWeight,
backgroundColor: bg,
)),
],
),
);
}