StickyAnnotation class

A sticky note annotation that can be placed anywhere on the canvas.

Sticky notes are free-floating annotations that can be used for comments, notes, or explanations within your node flow. They support:

  • Custom text content
  • Configurable size and color
  • Free movement and positioning
  • Optional node dependencies for tracking

Example

final sticky = StickyAnnotation(
  id: 'note-1',
  position: Offset(100, 100),
  text: 'This is a reminder',
  width: 200,
  height: 150,
  color: Colors.yellow,
);
controller.annotations.addAnnotation(sticky);
Inheritance

Constructors

StickyAnnotation({required String id, required Offset position, required String text, double width = 200.0, double height = 100.0, Color color = Colors.yellow, 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 {}})
StickyAnnotation.fromJsonMap(Map<String, dynamic> json)
Creates a StickyAnnotation from a JSON map.
factory

Properties

bounds Rect
Automatically calculated bounding rectangle for hit testing.
no setterinherited
color Color
The background color of the sticky note.
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
height double
The height of the sticky note in pixels.
final
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
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
text String
The text content displayed in the sticky note.
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
width double
The width of the sticky note in pixels.
final
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, String? text, double? width, double? height, Color? color, int? zIndex, bool? isVisible, bool? isInteractive, Set<String>? dependencies, Offset? offset, Map<String, dynamic>? metadata}) StickyAnnotation
Creates a copy of this sticky 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