copyWith method

CommentNode<T> copyWith({
  1. String? id,
  2. Offset? position,
  3. String? text,
  4. T? data,
  5. double? width,
  6. double? height,
  7. Color? color,
  8. int? zIndex,
  9. bool? isVisible,
  10. bool? locked,
})

Creates a copy of this comment node with optional property overrides.

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

Implementation

CommentNode<T> copyWith({
  String? id,
  Offset? position,
  String? text,
  T? data,
  double? width,
  double? height,
  Color? color,
  int? zIndex,
  bool? isVisible,
  bool? locked,
}) {
  return CommentNode<T>(
    id: id ?? this.id,
    position: position ?? this.position.value,
    text: text ?? this.text,
    data: data ?? this.data,
    width: width ?? this.width,
    height: height ?? this.height,
    color: color ?? this.color,
    zIndex: zIndex ?? this.zIndex.value,
    isVisible: isVisible ?? this.isVisible,
    locked: locked ?? this.locked,
  );
}