copyWith method

GroupAnnotation copyWith({
  1. String? id,
  2. Offset? position,
  3. Size? size,
  4. String? title,
  5. Color? color,
  6. GroupBehavior? behavior,
  7. Set<String>? nodeIds,
  8. EdgeInsets? padding,
  9. int? zIndex,
  10. bool? isVisible,
  11. bool? isInteractive,
  12. Map<String, dynamic>? metadata,
})

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

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

Implementation

GroupAnnotation copyWith({
  String? id,
  Offset? position,
  Size? size,
  String? title,
  Color? color,
  GroupBehavior? behavior,
  Set<String>? nodeIds,
  EdgeInsets? padding,
  int? zIndex,
  bool? isVisible,
  bool? isInteractive,
  Map<String, dynamic>? metadata,
}) {
  return GroupAnnotation(
    id: id ?? this.id,
    position: position ?? this.position,
    size: size ?? this.size,
    title: title ?? currentTitle,
    color: color ?? currentColor,
    behavior: behavior ?? this.behavior,
    nodeIds: nodeIds ?? Set.from(_nodeIds),
    padding: padding ?? this.padding,
    zIndex: zIndex ?? this.zIndex,
    isVisible: isVisible ?? this.isVisible,
    isInteractive: isInteractive ?? this.isInteractive,
    metadata: metadata ?? this.metadata,
  );
}