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

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, Set<String> dependencies = const {}, Offset offset = Offset.zero, 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
currentIsVisible bool
The current visibility state (non-reactive).
no setterinherited
currentPosition Offset
The current logical position value (non-reactive).
no setterinherited
currentSelected bool
The current selection state (non-reactive).
no setterinherited
currentVisualPosition Offset
The current visual (snapped) position value (non-reactive).
no setterinherited
currentZIndex int
The current z-index value (non-reactive).
no setterinherited
dependencies → ObservableSet<String>
Reactive observable set of node IDs this annotation depends on.
no setterinherited
hasAnyDependencies bool
Whether this annotation has any node dependencies.
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
id String
Unique identifier for this annotation.
finalinherited
isInteractive bool
Whether this annotation responds to user interactions.
finalinherited
isVisible → Observable<bool>
Reactive observable for the annotation's visibility state.
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
offset Offset
Offset from dependent node position (for following annotations).
finalinherited
position → Observable<Offset>
Reactive observable for the annotation's logical position.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
selected → Observable<bool>
Reactive observable for the annotation's selection state.
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 → Observable<Offset>
Reactive observable for the annotation's visual position.
no setterinherited
zIndex → Observable<int>
Reactive observable for the annotation's z-index (rendering order).
no setterinherited

Methods

addDependency(String nodeId) → void
Adds a node dependency to this annotation.
inherited
buildWidget(BuildContext context) Widget
Builds the visual representation of the annotation.
override
clearDependencies() → void
Clears all node dependencies from this annotation.
inherited
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, Set<String>? dependencies, 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
hasDependency(String nodeId) bool
Checks if this annotation depends on a specific node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
removeDependency(String nodeId) → void
Removes a node dependency from this annotation.
inherited
setPosition(Offset newPosition) → void
Sets the annotation's logical position.
inherited
setSelected(bool selected) → void
Sets the annotation's selection state.
inherited
setVisible(bool visible) → void
Sets the annotation's visibility state.
inherited
setVisualPosition(Offset snappedPosition) → void
Updates the visual position (used for rendering with grid snapping).
inherited
setZIndex(int newZIndex) → void
Sets the annotation's z-index (rendering order).
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