copyWith method
WidgetSpoilerConfig
copyWith({
- double? particleDensity,
- double? particleSpeed,
- Color? particleColor,
- double? maxParticleSize,
- bool? enableFadeAnimation,
- double? fadeRadius,
- double? fadeEdgeThickness,
- bool? isEnabled,
- bool? enableGestureReveal,
- SpoilerMask? maskConfig,
- ValueChanged<
bool> ? onSpoilerVisibilityChanged, - ShaderConfig? shaderConfig,
- FadeConfig? fadeConfig,
- ParticleConfig? particleConfig,
- ImageFilter? imageFilter,
- int? maxActiveWaves,
override
Implementation
@override
WidgetSpoilerConfig copyWith({
double? particleDensity,
double? particleSpeed,
Color? particleColor,
double? maxParticleSize,
bool? enableFadeAnimation,
double? fadeRadius,
double? fadeEdgeThickness,
bool? isEnabled,
bool? enableGestureReveal,
SpoilerMask? maskConfig,
ValueChanged<bool>? onSpoilerVisibilityChanged,
ShaderConfig? shaderConfig,
FadeConfig? fadeConfig,
ParticleConfig? particleConfig,
ImageFilter? imageFilter,
int? maxActiveWaves,
}) {
final bool legacyParticleOverridesProvided =
particleDensity != null || particleSpeed != null || particleColor != null || maxParticleSize != null;
final ParticleConfig nextParticleConfig = particleConfig ??
(legacyParticleOverridesProvided
? ParticleConfig(
density: particleDensity ?? this.particleConfig.density,
speed: particleSpeed ?? this.particleConfig.speed,
color: particleColor ?? this.particleConfig.color,
maxParticleSize: maxParticleSize ?? this.particleConfig.maxParticleSize,
shapePreset: this.particleConfig.shapePreset,
)
: this.particleConfig);
final bool legacyFadeOverridesProvided =
enableFadeAnimation != null || fadeRadius != null || fadeEdgeThickness != null;
final FadeConfig? nextFadeConfig = fadeConfig ??
(legacyFadeOverridesProvided
? ((enableFadeAnimation ?? (this.fadeConfig != null))
? FadeConfig(
padding: fadeRadius ?? (this.fadeConfig?.padding ?? 10.0),
edgeThickness: fadeEdgeThickness ?? (this.fadeConfig?.edgeThickness ?? 20.0),
)
: null)
: this.fadeConfig);
return WidgetSpoilerConfig(
imageFilter: imageFilter ?? this.imageFilter,
maxActiveWaves: maxActiveWaves ?? this.maxActiveWaves,
shaderConfig: shaderConfig ?? this.shaderConfig,
particleConfig: nextParticleConfig,
fadeConfig: nextFadeConfig,
isEnabled: isEnabled ?? this.isEnabled,
enableGestureReveal: enableGestureReveal ?? this.enableGestureReveal,
maskConfig: maskConfig ?? this.maskConfig,
onSpoilerVisibilityChanged: onSpoilerVisibilityChanged ?? this.onSpoilerVisibilityChanged,
);
}