MarkdownView class
A Markdown document viewer with a block cursor: content renders styled (headings tinted, inline bold/italic/code, blockquotes, fences), and one block (a line of the source) is selected at a time.
Up and Down move the selection a block at a time; PageUp, PageDown, Home, and End jump; clicking a block selects it. Ctrl+C copies the selected block's Markdown source, or the whole document when copyOptions sets MarkdownViewCopyMode.document.
- Inheritance
-
- Object
- Widget
- StatefulWidget
- MarkdownView
- Available extensions
Constructors
- MarkdownView({Key? key, required String markdown, MarkdownViewController? controller, FocusNode? focusNode, bool autofocus = false, String semanticLabel = 'Markdown', CellStyle? baseStyle, int? maxLineLength = 1000, int tabSize = 2, bool copySelection = true, MarkdownViewCopyOptions copyOptions = const MarkdownViewCopyOptions(), void onCopy(MarkdownViewCopyResult result)?})
-
const
- MarkdownView.document({Key? key, required MarkdownDocument document, MarkdownViewController? controller, FocusNode? focusNode, bool autofocus = false, String semanticLabel = 'Markdown', CellStyle? baseStyle, int? maxLineLength = 1000, int tabSize = 2, bool copySelection = true, MarkdownViewCopyOptions copyOptions = const MarkdownViewCopyOptions(), void onCopy(MarkdownViewCopyResult result)?})
-
Creates a viewer from an already parsed MarkdownDocument.
maxLineLengthandtabSizehave no effect here.const
Properties
- autofocus → bool
-
Whether the viewer should request focus when mounted.
final
- baseStyle → CellStyle?
-
Base text style merged into rendered Markdown spans.
final
- controller → MarkdownViewController?
-
External selection and visible-range controller.
final
- copyOptions → MarkdownViewCopyOptions
-
Clipboard/export options for copied Markdown text.
final
- copySelection → bool
-
Whether Ctrl+C (and the semantic copy action) copies the selected block,
or the document if copyOptions says so.
final
- document → MarkdownDocument?
-
An already parsed document to render; null for MarkdownView.new.
final
- focusNode → FocusNode?
-
Focus node used for keyboard navigation.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
finalinherited
- markdown → String?
-
Markdown source to render, parsed by the view. The parse is kept while
the source is unchanged, and an appended source re-parses only its last
line onward, so streaming into a long document stays cheap. Null for
MarkdownView.document.
final
- maxLineLength → int?
-
Cuts each block's text, inline Markdown markers included, to this many
characters before styling, ending it with
…; null never cuts. Copying still copies the full source.final - onCopy → void Function(MarkdownViewCopyResult result)?
-
Called after a copy attempt completes.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- semanticLabel → String
-
Semantic label (the accessibility name; not rendered) for the Markdown viewer.
final
- tabSize → int
-
Number of spaces used when expanding tabs.
final
Methods
-
animate(
{Duration? duration, Curve? curve, Object? trigger, bool repeat = false}) → Animate -
Available on Widget, provided by the AnimateExtension extension
Starts an Animate chain over this widget.duration/curveapply to the whole chain. With notriggerit plays on mount; with a non-null trigger it rests on mount and replays whenever the token changes. -
createElement(
) → StatefulElement -
Creates the Element that will mount this widget into the tree.
inherited
-
createState(
) → State< MarkdownView> -
Creates the mutable state for this widget at the current location in
the tree. Called exactly once per StatefulElement instance.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited