MermaidView class

Displays a mermaid diagram with interactive pan/zoom controls.

The diagram is framed to fit on first layout and whenever the viewport changes size. A source change is also re-framed unless you've panned or zoomed. Drag to pan and scroll/pinch to zoom; the on-canvas controls give discrete pan, zoom, reset and a fullscreen popup. Wrap it in a bounded box (it fills its parent).

Inheritance

Constructors

MermaidView({Key? key, required String source, MermaidViewController? controller, MermaidTheme theme = core.MermaidTheme.defaultTheme, Widget errorBuilder(BuildContext context, Object error)?, bool keepLastGoodSceneOnError = true, void onNodeTap(String id, String? link)?, ValueChanged<String?>? onNodeHover, MouseCursor hoverCursor = SystemMouseCursors.click, MermaidNodeTooltipBuilder? nodeTooltipBuilder, bool semanticNodes = false, void onEdgeTap(String fromId, String toId, int linkIndex)?, ValueChanged<RenderScene>? onSceneChanged, Map<String, FlowNodePaintOverride> nodePaintOverrides = const {}, Map<int, FlowLinkPaintOverride> linkPaintOverrides = const {}, double minScale = 0.2, double maxScale = 8.0, double zoomStep = 1.25, double panStep = 64.0, double padding = 20.0, bool showControls = true, bool allowFullscreen = true, VoidCallback? onRequestFullscreen, Color? backgroundColor})
const

Properties

allowFullscreen → bool
Whether the controls include a fullscreen popup button.
final
backgroundColor → Color?
Background painted behind the diagram (defaults to transparent).
final
controller → MermaidViewController?
Optional controller for fit, focus, and transformation observation.
final
errorBuilder → Widget Function(BuildContext context, Object error)?
See MermaidDiagram.errorBuilder.
final
hashCode → int
The hash code for this object.
no setterinherited
hoverCursor → MouseCursor
See MermaidDiagram.hoverCursor.
final
keepLastGoodSceneOnError → bool
See MermaidDiagram.keepLastGoodSceneOnError.
final
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
linkPaintOverrides → Map<int, FlowLinkPaintOverride>
See MermaidDiagram.linkPaintOverrides.
final
maxScale → double
final
minScale → double
Zoom bounds and the factor applied per zoom-button press.
final
nodePaintOverrides → Map<String, FlowNodePaintOverride>
See MermaidDiagram.nodePaintOverrides.
final
nodeTooltipBuilder → MermaidNodeTooltipBuilder?
See MermaidDiagram.nodeTooltipBuilder.
final
onEdgeTap → void Function(String fromId, String toId, int linkIndex)?
See MermaidDiagram.onEdgeTap.
final
onNodeHover → ValueChanged<String?>?
See MermaidDiagram.onNodeHover.
final
onNodeTap → void Function(String id, String? link)?
See MermaidDiagram.onNodeTap.
final
onRequestFullscreen → VoidCallback?
If set, the fullscreen button calls this instead of showing the built-in in-Flutter dialog. Use it when the diagram is embedded inside a larger host (e.g. a Flutter web view on an HTML page) where an in-Flutter dialog can't escape the view's bounds — the host can then present a true full-page overlay.
final
onSceneChanged → ValueChanged<RenderScene>?
See MermaidDiagram.onSceneChanged.
final
padding → double
Padding (px) left around the diagram when fitting it to the viewport.
final
panStep → double
Pixels panned per arrow-button press (in viewport space).
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
semanticNodes → bool
See MermaidDiagram.semanticNodes.
final
showControls → bool
Whether to show the on-canvas control cluster.
final
source → String
Mermaid diagram source text.
final
theme → MermaidTheme
Resolved mermaid theme used for layout and painting.
final
zoomStep → double
final

Methods

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