copyWith method
AlertTheme
copyWith({
- ValueGetter<
EdgeInsetsGeometry?> ? padding, - ValueGetter<
Color?> ? backgroundColor, - ValueGetter<
Color?> ? borderColor,
Creates a copy of this theme with the given values replaced.
Uses ValueGetter functions to allow conditional replacement of values. If a getter function is null, the original value is preserved.
Returns: A new AlertTheme instance with updated values.
Example:
final newTheme = theme.copyWith(
backgroundColor: () => Colors.red,
);
Implementation
AlertTheme copyWith({
ValueGetter<EdgeInsetsGeometry?>? padding,
ValueGetter<Color?>? backgroundColor,
ValueGetter<Color?>? borderColor,
}) {
return AlertTheme(
padding: padding == null ? this.padding : padding(),
backgroundColor:
backgroundColor == null ? this.backgroundColor : backgroundColor(),
borderColor: borderColor == null ? this.borderColor : borderColor(),
);
}