SmoothMarkdownEditor class

A Markdown source editor with formatted editing, live preview, and Scratch-inspired commands.

The document source remains plain Markdown. Formatting buttons and keyboard shortcuts edit that source, while SmoothMarkdown renders preview output.

Inheritance

Constructors

SmoothMarkdownEditor({Key? key, MarkdownEditorController? controller, String data = '', ValueChanged<String>? onChanged, MarkdownEditorMode? mode, MarkdownEditorMode initialMode = MarkdownEditorMode.formatted, ValueChanged<MarkdownEditorMode>? onModeChanged, MarkdownEditorThemeData? editorTheme, MarkdownStyleSheet? styleSheet, MarkdownConfig? config, void onTapLink(String url)?, void onTapImage(String url, String? alt, String? title)?, MarkdownEditorImagePickerCallback? onPickImage, MarkdownEditorImagePickEventCallback? onImagePickEvent, Widget imageBuilder(String url, String? alt, String? title)?, Widget codeBuilder(String code, String? language)?, MarkdownEditorCustomBlockBuilder? customBlockBuilder, MarkdownEditorCustomBlockEditorBuilder? customBlockEditorBuilder, bool useEnhancedComponents = true, bool enableCache = true, ParserPluginRegistry? plugins, BuilderRegistry? builderRegistry, bool showToolbar = true, bool initialFocusMode = false, ValueChanged<bool>? onFocusModeChanged, bool enableSlashCommands = true, List<MarkdownEditorSlashCommand> customSlashCommands = const [], MarkdownEditorCapabilities capabilities = MarkdownEditorCapabilities.all, List<MarkdownEditorCommand>? toolbarCommands, List<Widget> toolbarLeading = const <Widget>[], List<Widget> toolbarTrailing = const <Widget>[], MarkdownEditorToolbarBuilder? toolbarBuilder, bool enableKeyboardShortcuts = true, MarkdownEditorShortcutCallback? onShortcut, ValueChanged<MarkdownEditorCommand>? onCommand, ValueChanged<TextSelection>? onSelectionChanged, ValueChanged<bool>? onFocusChanged, MarkdownEditorPerformanceCallback? onPerformanceSnapshot, bool enableWikilinks = true, List<String> wikilinkSuggestions = const [], void onTapWikilink(String url)?, MarkdownEditorMarkdownExportCallback? onExportMarkdown, MarkdownEditorPdfExportCallback? onExportPdf, MarkdownEditorMarkdownImportCallback? onImportMarkdown, double? height, double minHeight = 360, bool autofocus = false, bool enabled = true, FocusNode? focusNode, TextStyle? textStyle, String? placeholder, Decoration? decoration, Decoration? sourceDecoration, Decoration? previewDecoration})
Creates a Markdown editor.
const

Properties

autofocus bool
Whether the source editor should autofocus.
final
builderRegistry BuilderRegistry?
Builder registry forwarded to SmoothMarkdown.
final
capabilities MarkdownEditorCapabilities
Built-in command availability for toolbar, shortcuts, and slash commands.
final
codeBuilder Widget Function(String code, String? language)?
Code block builder forwarded to SmoothMarkdown.
final
config MarkdownConfig?
Parser config forwarded to SmoothMarkdown.
final
controller MarkdownEditorController?
Optional controller. If omitted, the editor owns an internal controller.
final
customBlockBuilder MarkdownEditorCustomBlockBuilder?
Host-provided renderer for custom formatted blocks.
final
customBlockEditorBuilder MarkdownEditorCustomBlockEditorBuilder?
Host-provided editor for custom formatted blocks.
final
customSlashCommands List<MarkdownEditorSlashCommand>
Extra host-provided slash commands appended after built-in commands.
final
data String
Initial Markdown text used when controller is omitted.
final
decoration Decoration?
Decoration for the whole editor.
final
editorTheme MarkdownEditorThemeData?
Editor-specific visual styling.
final
enableCache bool
Whether preview parsing may use the shared cache.
final
enabled bool
Whether source editing and commands are enabled.
final
enableKeyboardShortcuts bool
Whether built-in keyboard shortcuts are handled.
final
enableSlashCommands bool
Whether / at the start of the current line opens command suggestions.
final
Whether preview parses and renders [[wikilinks]].
final
focusNode FocusNode?
Optional focus node for the source editor.
final
hashCode int
The hash code for this object.
no setterinherited
height double?
Fixed source/preview area height. Defaults to minHeight.
final
imageBuilder Widget Function(String url, String? alt, String? title)?
Image builder forwarded to SmoothMarkdown.
final
initialFocusMode bool
Whether the editor starts in distraction-free focus mode.
final
initialMode MarkdownEditorMode
Initial editor display mode.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
minHeight double
Default content area height when height is omitted.
final
mode MarkdownEditorMode?
Controlled editor display mode.
final
onChanged ValueChanged<String>?
Called whenever the Markdown source changes.
final
onCommand ValueChanged<MarkdownEditorCommand>?
Called after a built-in editor command is accepted.
final
onExportMarkdown MarkdownEditorMarkdownExportCallback?
Called when the export menu requests a Markdown file export.
final
onExportPdf MarkdownEditorPdfExportCallback?
Called when the export menu or Cmd/Ctrl+Shift+P requests PDF/print export.
final
onFocusChanged ValueChanged<bool>?
Called when the source editor focus changes.
final
onFocusModeChanged ValueChanged<bool>?
Called when focus mode changes.
final
onImagePickEvent MarkdownEditorImagePickEventCallback?
Called when image picking, upload, insertion, cancellation, or failure state changes.
final
onImportMarkdown MarkdownEditorMarkdownImportCallback?
Called when the import menu requests host-provided Markdown content.
final
onModeChanged ValueChanged<MarkdownEditorMode>?
Called when the display mode changes.
final
onPerformanceSnapshot MarkdownEditorPerformanceCallback?
Called after editor state changes with lightweight performance telemetry.
final
onPickImage MarkdownEditorImagePickerCallback?
Called when the image command should pick/import an image.
final
onSelectionChanged ValueChanged<TextSelection>?
Called when the source selection changes.
final
onShortcut MarkdownEditorShortcutCallback?
Host-provided shortcut hook.
final
onTapImage → void Function(String url, String? alt, String? title)?
Image tap callback forwarded to SmoothMarkdown.
final
Called when an external link is activated with Scratch's Cmd/Ctrl+click editor gesture.
final
Called when a rendered wikilink is tapped.
final
placeholder String?
Source editor placeholder.
final
plugins ParserPluginRegistry?
Parser plugins forwarded to SmoothMarkdown.
final
previewDecoration Decoration?
Decoration for the preview pane.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
showToolbar bool
Whether to show the formatting toolbar.
final
sourceDecoration Decoration?
Decoration for the source pane.
final
styleSheet MarkdownStyleSheet?
Style sheet forwarded to SmoothMarkdown.
final
textStyle TextStyle?
Source text style.
final
toolbarBuilder MarkdownEditorToolbarBuilder?
Wraps or replaces the default toolbar widget.
final
toolbarCommands List<MarkdownEditorCommand>?
Built-in command buttons to show, in order.
final
toolbarLeading List<Widget>
Host-provided widgets inserted before the built-in toolbar controls.
final
toolbarTrailing List<Widget>
Host-provided widgets inserted after the built-in toolbar controls.
final
useEnhancedComponents bool
Whether preview should use enhanced markdown components.
final
wikilinkSuggestions List<String>
Candidate note titles for [[ autocomplete.
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<SmoothMarkdownEditor>
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited