SmoothMarkdown constructor
const
SmoothMarkdown({
- required String data,
- Key? key,
- MarkdownStyleSheet? styleSheet,
- MarkdownConfig? config,
- void onTapLink(
- String url
- Widget imageBuilder()?,
- Widget codeBuilder()?,
- bool useEnhancedComponents = false,
- bool enableCache = true,
- bool useRepaintBoundary = true,
- ParserPluginRegistry? plugins,
- BuilderRegistry? builderRegistry,
Creates a widget that renders Markdown content.
The data parameter is required and contains the Markdown text to render.
All other parameters are optional and provide customization options:
styleSheet: Controls the visual styling of markdown elements. Defaults to MarkdownStyleSheet.light if not provided.config: Configuration options for markdown parsing behavior. Most features are enabled by default.onTapLink: Callback function invoked when a link is tapped. Receives the URL as a string parameter.imageBuilder: Custom widget builder for rendering images. If not provided, uses the default image renderer with network caching.codeBuilder: Custom widget builder for rendering code blocks. If not provided, uses the default code block renderer with syntax highlighting.useEnhancedComponents: Whentrue, uses enhanced UI components with additional visual effects and interactions. Defaults tofalse.
Example:
SmoothMarkdown(
data: '# Title\n\nThis is **bold** text.',
styleSheet: MarkdownStyleSheet.github(),
useEnhancedComponents: true,
onTapLink: (url) => launchUrl(Uri.parse(url)),
)
Implementation
const SmoothMarkdown({
required this.data,
super.key,
this.styleSheet,
this.config,
this.onTapLink,
this.imageBuilder,
this.codeBuilder,
this.useEnhancedComponents = false,
this.enableCache = true,
this.useRepaintBoundary = true,
this.plugins,
this.builderRegistry,
});