merge method

CheckboxStyle merge(
  1. CheckboxStyle? other
)

Creates a copy of this CheckboxStyle but with the given fields replaced with the new values.

Implementation

CheckboxStyle merge(CheckboxStyle? other) {
  // if null return current object
  if (other == null) return this;

  var style = copyWith(
    size: other.size,
    shape: other.shape,
    margin: other.margin,
    padding: other.padding,
    backgroundColor: other.backgroundColor,
    backgroundOpacity: other.backgroundOpacity,
    backgroundAlpha: other.backgroundAlpha,
    borderColor: other.borderColor,
    borderOpacity: other.borderOpacity,
    borderAlpha: other.borderAlpha,
    borderWidth: other.borderWidth,
    borderRadius: other.borderRadius,
    borderStyle: other.borderStyle,
    checkmarkInset: other.checkmarkInset,
    checkmarkColor: other.checkmarkColor,
    checkmarkOpacity: other.checkmarkOpacity,
    checkmarkAlpha: other.checkmarkAlpha,
    checkmarkWeight: other.checkmarkWeight,
    checkmarkStyle: other.checkmarkStyle,
    overlayColor: other.overlayColor,
    overlayOpacity: other.overlayOpacity,
    overlayDisabled: other.overlayDisabled,
    overlayRadius: other.overlayRadius,
  );

  if (other is DrivenCheckboxStyle) {
    style = style.copyWith(
      selectedStyle: other.selectedStyle,
      indeterminateStyle: other.indeterminateStyle,
      focusedStyle: other.focusedStyle,
      hoveredStyle: other.hoveredStyle,
      pressedStyle: other.pressedStyle,
      disabledStyle: other.disabledStyle,
      mergeResolved: other.mergeResolved,
    );
  }

  return style;
}