copyWith method

CheckboxTheme copyWith({
  1. ValueGetter<Color?>? activeColor,
  2. ValueGetter<Color?>? borderColor,
  3. ValueGetter<double?>? size,
  4. ValueGetter<double?>? gap,
  5. ValueGetter<BorderRadiusGeometry?>? borderRadius,
})

Creates a copy of this theme with specified properties overridden.

Each parameter function is called only if provided, allowing selective overrides while preserving existing values for unspecified properties.

Example:

final newTheme = theme.copyWith(
  activeColor: () => Colors.green,
  size: () => 20.0,
);

Implementation

CheckboxTheme copyWith({
  ValueGetter<Color?>? activeColor,
  ValueGetter<Color?>? borderColor,
  ValueGetter<double?>? size,
  ValueGetter<double?>? gap,
  ValueGetter<BorderRadiusGeometry?>? borderRadius,
}) {
  return CheckboxTheme(
    activeColor: activeColor == null ? this.activeColor : activeColor(),
    borderColor: borderColor == null ? this.borderColor : borderColor(),
    size: size == null ? this.size : size(),
    gap: gap == null ? this.gap : gap(),
    borderRadius: borderRadius == null ? this.borderRadius : borderRadius(),
  );
}