copyWith method
AvatarTheme
copyWith({
- ValueGetter<
double?> ? size, - ValueGetter<
double?> ? borderRadius, - ValueGetter<
Color?> ? backgroundColor, - ValueGetter<
AlignmentGeometry?> ? badgeAlignment, - ValueGetter<
double?> ? badgeGap, - 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(),
);
}