copyWith method

SelectableTextTheme copyWith({
  1. ValueGetter<double?>? cursorWidth,
  2. ValueGetter<double?>? cursorHeight,
  3. ValueGetter<Radius?>? cursorRadius,
  4. ValueGetter<Color?>? cursorColor,
  5. ValueGetter<BoxHeightStyle?>? selectionHeightStyle,
  6. ValueGetter<BoxWidthStyle?>? selectionWidthStyle,
  7. ValueGetter<bool?>? enableInteractiveSelection,
})

Creates a copy of this theme with optionally replaced values.

Uses ValueGetter functions to allow nullable value replacement. Properties not provided retain their current values.

Parameters:

  • cursorWidth: Optional getter for new cursor width
  • cursorHeight: Optional getter for new cursor height
  • cursorRadius: Optional getter for new cursor radius
  • cursorColor: Optional getter for new cursor color
  • selectionHeightStyle: Optional getter for new selection height style
  • selectionWidthStyle: Optional getter for new selection width style
  • enableInteractiveSelection: Optional getter for new interactive selection state

Returns a new SelectableTextTheme with updated values.

Implementation

SelectableTextTheme copyWith({
  ValueGetter<double?>? cursorWidth,
  ValueGetter<double?>? cursorHeight,
  ValueGetter<Radius?>? cursorRadius,
  ValueGetter<Color?>? cursorColor,
  ValueGetter<ui.BoxHeightStyle?>? selectionHeightStyle,
  ValueGetter<ui.BoxWidthStyle?>? selectionWidthStyle,
  ValueGetter<bool?>? enableInteractiveSelection,
}) {
  return SelectableTextTheme(
    cursorWidth: cursorWidth == null ? this.cursorWidth : cursorWidth(),
    cursorHeight: cursorHeight == null ? this.cursorHeight : cursorHeight(),
    cursorRadius: cursorRadius == null ? this.cursorRadius : cursorRadius(),
    cursorColor: cursorColor == null ? this.cursorColor : cursorColor(),
    selectionHeightStyle: selectionHeightStyle == null
        ? this.selectionHeightStyle
        : selectionHeightStyle(),
    selectionWidthStyle: selectionWidthStyle == null
        ? this.selectionWidthStyle
        : selectionWidthStyle(),
    enableInteractiveSelection: enableInteractiveSelection == null
        ? this.enableInteractiveSelection
        : enableInteractiveSelection(),
  );
}