copyWith method

CardImageTheme copyWith({
  1. ValueGetter<AbstractButtonStyle?>? style,
  2. ValueGetter<Axis?>? direction,
  3. ValueGetter<double?>? hoverScale,
  4. ValueGetter<double?>? normalScale,
  5. ValueGetter<Color?>? backgroundColor,
  6. ValueGetter<Color?>? borderColor,
  7. ValueGetter<double?>? gap,
})

Creates a copy of this theme with optionally overridden properties.

Uses ValueGetter functions to allow nullable overrides.

Example:

final newTheme = existingTheme.copyWith(
  hoverScale: () => 1.2,
  backgroundColor: () => Colors.blue.shade50,
);

Implementation

CardImageTheme copyWith({
  ValueGetter<AbstractButtonStyle?>? style,
  ValueGetter<Axis?>? direction,
  ValueGetter<double?>? hoverScale,
  ValueGetter<double?>? normalScale,
  ValueGetter<Color?>? backgroundColor,
  ValueGetter<Color?>? borderColor,
  ValueGetter<double?>? gap,
}) {
  return CardImageTheme(
    style: style == null ? this.style : style(),
    direction: direction == null ? this.direction : direction(),
    hoverScale: hoverScale == null ? this.hoverScale : hoverScale(),
    normalScale: normalScale == null ? this.normalScale : normalScale(),
    backgroundColor:
        backgroundColor == null ? this.backgroundColor : backgroundColor(),
    borderColor: borderColor == null ? this.borderColor : borderColor(),
    gap: gap == null ? this.gap : gap(),
  );
}