MarkerAnnotation class
A small visual indicator for workflow elements (BPMN-style markers).
Markers are compact annotations that attach semantic meaning to nodes or positions in the workflow. They're rendered as circular badges with icons and optional tooltips.
Common use cases include:
- Indicating task types (user, script, service)
- Showing status (error, warning, info)
- Marking special workflow points (decision, milestone)
- Highlighting compliance or risk areas
Example
final errorMarker = MarkerAnnotation(
id: 'marker-1',
position: Offset(150, 200),
markerType: MarkerType.error,
color: Colors.red,
tooltip: 'Validation failed',
);
controller.annotations.addAnnotation(errorMarker);
- Inheritance
-
- Object
- Annotation
- MarkerAnnotation
Constructors
-
MarkerAnnotation({required String id, required Offset position, MarkerType markerType = MarkerType.info, double markerSize = 24.0, Color color = Colors.red, String? tooltip, int zIndex = 0, bool isVisible = true, bool selected = false, bool isInteractive = true, Map<
String, dynamic> metadata = const {}}) -
MarkerAnnotation.fromJsonMap(Map<
String, dynamic> json) -
Creates a MarkerAnnotation from a JSON map.
factory
Properties
- bounds → Rect
-
Automatically calculated bounding rectangle for hit testing.
no setterinherited
- color → Color
-
The color of the marker icon.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- id → String
-
Unique identifier for this annotation.
finalinherited
- isEditing ↔ bool
-
Whether the annotation is currently in edit mode.
getter/setter pairinherited
- isEmpty → bool
-
Whether this annotation is considered "empty" and has no content.
no setterinherited
- isInteractive → bool
-
Whether this annotation responds to user interactions.
finalinherited
- isResizable → bool
-
Whether this annotation can be resized by the user.
no setterinherited
- isVisible ↔ bool
-
Whether the annotation is visible.
getter/setter pairinherited
- layer → AnnotationRenderLayer
-
The rendering layer for this annotation.
no setterinherited
- markerSize → double
-
The size of the marker in pixels (both width and height).
final
- markerType → MarkerType
-
The type of marker, determining its icon and semantic meaning.
final
-
metadata
→ Map<
String, dynamic> -
Additional metadata for custom data storage.
finalinherited
-
monitoredNodeIds
→ Set<
String> -
The set of node IDs that this annotation monitors for position/size changes.
no setterinherited
- monitorNodes → bool
-
Whether this annotation should receive automatic node lifecycle callbacks.
no setterinherited
- position ↔ Offset
-
The annotation's logical position (before grid snapping).
getter/setter pairinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- selected ↔ bool
-
Whether the annotation is currently selected.
getter/setter pairinherited
- shouldRemoveWhenEmpty → bool
-
Whether this annotation should be automatically removed when empty.
no setterinherited
- size → Size
-
The dimensions of the annotation for automatic hit testing.
no setteroverride
- tooltip → String?
-
Optional tooltip text shown on hover.
final
- type → String
-
The type of annotation (e.g., 'sticky', 'group', 'marker').
finalinherited
- visualPosition ↔ Offset
-
The annotation's visual position (after grid snapping).
getter/setter pairinherited
- zIndex ↔ int
-
The annotation's z-index (rendering order within its layer).
getter/setter pairinherited
Methods
-
buildWidget(
BuildContext context) → Widget -
Builds the visual representation of the annotation.
override
-
containsPoint(
Offset point) → bool -
Automatic hit testing based on position and size.
inherited
-
copyWith(
{String? id, Offset? position, MarkerType? markerType, double? size, Color? color, String? tooltip, int? zIndex, bool? isVisible, bool? isInteractive, Map< String, dynamic> ? metadata}) → MarkerAnnotation - Creates a copy of this marker annotation with optional property overrides.
-
fromJson(
Map< String, dynamic> json) → void -
Deserializes JSON data into this annotation.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onDragEnd(
) → void -
Called when a drag operation ends on this annotation.
inherited
-
onDragMove(
Offset delta, AnnotationDragContext context) → void -
Called during drag with the movement delta.
inherited
-
onDragStart(
AnnotationDragContext context) → void -
Called when a drag operation starts on this annotation.
inherited
-
onNodeAdded(
String nodeId, Rect nodeBounds, AnnotationDragContext context) → bool -
Called when a new node is added to the graph.
inherited
-
onNodeMoved(
String nodeId, Offset newPosition, AnnotationDragContext context) → void -
Called when a node's position changes.
inherited
-
onNodeResized(
String nodeId, Size newSize, AnnotationDragContext context) → void -
Called when a node's size changes.
inherited
-
onNodesDeleted(
Set< String> nodeIds, AnnotationDragContext context) → void -
Called when nodes are deleted from the graph.
inherited
-
onNodeVisibilityChanged(
String nodeId, bool isVisible) → void -
Called when a node's visibility changes.
inherited
-
onSelectionChanged(
Set< String> selectedNodeIds) → void -
Called when the node selection changes.
inherited
-
setSize(
Size newSize) → void -
Sets the size of this annotation.
inherited
-
toJson(
) → Map< String, dynamic> -
Serializes this annotation to JSON.
override
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited