copyWith method

AvatarTheme copyWith({
  1. ValueGetter<double?>? size,
  2. ValueGetter<double?>? borderRadius,
  3. ValueGetter<Color?>? backgroundColor,
  4. ValueGetter<AlignmentGeometry?>? badgeAlignment,
  5. ValueGetter<double?>? badgeGap,
  6. ValueGetter<TextStyle?>? textStyle,
})

Creates a copy of this theme with the given values replaced.

Uses ValueGetter functions to allow conditional updates where null getters preserve the original value.

Example:

final newTheme = originalTheme.copyWith(
  size: () => 60.0,
  backgroundColor: () => Colors.blue.shade100,
);

Implementation

AvatarTheme copyWith({
  ValueGetter<double?>? size,
  ValueGetter<double?>? borderRadius,
  ValueGetter<Color?>? backgroundColor,
  ValueGetter<AlignmentGeometry?>? badgeAlignment,
  ValueGetter<double?>? badgeGap,
  ValueGetter<TextStyle?>? textStyle,
}) {
  return AvatarTheme(
    size: size == null ? this.size : size(),
    borderRadius:
        borderRadius == null ? this.borderRadius : borderRadius(),
    backgroundColor:
        backgroundColor == null ? this.backgroundColor : backgroundColor(),
    badgeAlignment:
        badgeAlignment == null ? this.badgeAlignment : badgeAlignment(),
    badgeGap: badgeGap == null ? this.badgeGap : badgeGap(),
    textStyle: textStyle == null ? this.textStyle : textStyle(),
  );
}