DmMarkdownInput class

A markdown editor with write/preview tabs, syntax highlighting, and keyboard shortcuts.

Mirrors <el-dm-markdown-input> from the DuskMoon web elements library.

DmMarkdownInput(
  controller: myController,
  onChanged: (text) => print('Updated: $text'),
)
Inheritance

Constructors

DmMarkdownInput({Key? key, DmMarkdownInputController? controller, String? initialValue, DmMarkdownConfig config = const DmMarkdownConfig(), DmMarkdownTab initialTab = DmMarkdownTab.write, ValueChanged<String>? onChanged, ValueChanged<DmMarkdownTab>? onTabChanged, bool showLineNumbers = false, int? maxLines, int minLines = 10, bool readOnly = false, bool enabled = true, String tabLabelWrite = 'Write', String tabLabelPreview = 'Preview', bool showPreview = true, void onLinkTap(String url, String? title)?, InputDecoration? decoration, Widget? bottom, Widget? bottomLeft, Widget? bottomRight})
Creates a markdown input widget.
const

Properties

bottom → Widget?
A fully custom bottom bar widget. When set, bottomLeft and bottomRight are ignored.
final
bottomLeft → Widget?
Widget placed on the left side of the bottom bar.
final
bottomRight → Widget?
Widget placed on the right side of the bottom bar.
final
config → DmMarkdownConfig
Rendering configuration for the preview.
final
controller → DmMarkdownInputController?
External controller. If null, creates an internal one.
final
decoration → InputDecoration?
Custom input decoration for the editor field.
final
enabled → bool
Whether the widget is enabled.
final
hashCode → int
The hash code for this object.
no setterinherited
initialTab → DmMarkdownTab
The initial active tab.
final
initialValue → String?
Initial text value (used only when controller is null).
final
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
maxLines → int?
Maximum number of visible lines in the editor.
final
minLines → int
Minimum number of visible lines in the editor.
final
onChanged → ValueChanged<String>?
Called when the text content changes.
final
onLinkTap → void Function(String url, String? title)?
Link tap callback in preview mode.
final
onTabChanged → ValueChanged<DmMarkdownTab>?
Called when the active tab changes.
final
readOnly → bool
Whether the editor is read-only (shows preview only).
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
showLineNumbers → bool
Whether to show line numbers in the editor.
final
showPreview → bool
Whether to show the preview tab. When false, only the editor is shown.
final
tabLabelPreview → String
Label for the preview tab.
final
tabLabelWrite → String
Label for the write tab.
final

Methods

createElement() → StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → State<DmMarkdownInput>
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