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
- Resizing via drag handles
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
-
- Object
- Annotation
- StickyAnnotation
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, 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
- hashCode → int
-
The hash code for this object.
no setterinherited
- height ↔ double
-
The height of the sticky note in pixels.
getter/setter pair
- 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 setteroverride
- isVisible ↔ bool
-
Whether the annotation is visible.
getter/setter pairinherited
- layer → AnnotationRenderLayer
-
The rendering layer for this annotation.
no setterinherited
-
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
- text ↔ String
-
The text content displayed in the sticky note.
getter/setter pair
- 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
- width ↔ double
-
The width of the sticky note in pixels.
getter/setter pair
- 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, String? text, double? width, double? height, Color? color, int? zIndex, bool? isVisible, bool? isInteractive, 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
-
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.
override
-
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