copyWith method

GroupNode<T> copyWith({
  1. String? id,
  2. Offset? position,
  3. Size? size,
  4. String? title,
  5. T? data,
  6. Color? color,
  7. GroupBehavior? behavior,
  8. Set<String>? nodeIds,
  9. EdgeInsets? padding,
  10. int? zIndex,
  11. bool? isVisible,
  12. bool? locked,
  13. List<Port>? inputPorts,
  14. List<Port>? outputPorts,
})

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

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

Implementation

GroupNode<T> copyWith({
  String? id,
  Offset? position,
  Size? size,
  String? title,
  T? data,
  Color? color,
  GroupBehavior? behavior,
  Set<String>? nodeIds,
  EdgeInsets? padding,
  int? zIndex,
  bool? isVisible,
  bool? locked,
  List<Port>? inputPorts,
  List<Port>? outputPorts,
}) {
  return GroupNode<T>(
    id: id ?? this.id,
    position: position ?? this.position.value,
    size: size ?? this.size.value,
    title: title ?? currentTitle,
    data: data ?? this.data,
    color: color ?? currentColor,
    behavior: behavior ?? this.behavior,
    nodeIds: nodeIds ?? Set.from(_nodeIds),
    padding: padding ?? this.padding,
    zIndex: zIndex ?? this.zIndex.value,
    isVisible: isVisible ?? this.isVisible,
    locked: locked ?? this.locked,
    inputPorts: inputPorts ?? List.from(this.inputPorts),
    outputPorts: outputPorts ?? List.from(this.outputPorts),
  );
}