copyWith method

  1. @override
TextFieldCell copyWith({
  1. double? cellWidth,
  2. double? cellHeight,
  3. double? textSize,
})
override

Creates a new instance of the ReportCell with updated dimensions.

This method is crucial for the dynamic resizing logic within ReportMaker and ReportDesignBuilder. It allows the engine to adjust cell sizes during the layout phase while preserving the cell's internal data.

Implementation

@override
TextFieldCell copyWith({
  double? cellWidth,
  double? cellHeight,
  double? textSize,
}) {
  return TextFieldCell(
    key: key,
    // CRITICAL: Pass the existing controller so text is not lost on resize!
    controller: controller,
    onChanged: onChanged,
    cellWidth: cellWidth ?? this.cellWidth,
    cellHeight: cellHeight ?? this.cellHeight,
    textSize: textSize ?? this.textSize,
    textAlignment: textAlignment,
    backgroundColor: backgroundColor,
    textColor: textColor,
    borderColor: borderColor,
    isBold: isBold,
    decoration: decoration,
    // 3. CRITICAL: Pass the new properties so they persist on resize!
    keyboardType: keyboardType,
    inputFormatters: inputFormatters,
  );
}