copyWith method

StickyAnnotation copyWith({
  1. String? id,
  2. Offset? position,
  3. String? text,
  4. double? width,
  5. double? height,
  6. Color? color,
  7. int? zIndex,
  8. bool? isVisible,
  9. bool? isInteractive,
  10. Set<String>? dependencies,
  11. Offset? offset,
  12. Map<String, dynamic>? metadata,
})

Creates a copy of this sticky annotation with optional property overrides.

This is useful for creating variations of an existing sticky note or for implementing undo/redo functionality.

Implementation

StickyAnnotation 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,
}) {
  return StickyAnnotation(
    id: id ?? this.id,
    position: position ?? currentPosition,
    text: text ?? this.text,
    width: width ?? this.width,
    height: height ?? this.height,
    color: color ?? this.color,
    zIndex: zIndex ?? currentZIndex,
    isVisible: isVisible ?? currentIsVisible,
    isInteractive: isInteractive ?? this.isInteractive,
    dependencies: dependencies ?? this.dependencies.toSet(),
    offset: offset ?? this.offset,
    metadata: metadata ?? this.metadata,
  );
}