copyWith method
SpoilerConfig
copyWith({
- double? particleDensity,
- double? particleSpeed,
- Color? particleColor,
- double? maxParticleSize,
- bool? enableFadeAnimation,
- double? fadeRadius,
- double? fadeEdgeThickness,
- bool? isEnabled,
- bool? enableGestureReveal,
- ParticleConfig? particleConfig,
- FadeConfig? fadeConfig,
- SpoilerMask? maskConfig,
- ValueChanged<
bool> ? onSpoilerVisibilityChanged, - ShaderConfig? shaderConfig,
Implementation
SpoilerConfig copyWith({
double? particleDensity,
double? particleSpeed,
Color? particleColor,
double? maxParticleSize,
bool? enableFadeAnimation,
double? fadeRadius,
double? fadeEdgeThickness,
bool? isEnabled,
bool? enableGestureReveal,
ParticleConfig? particleConfig,
FadeConfig? fadeConfig,
SpoilerMask? maskConfig,
ValueChanged<bool>? onSpoilerVisibilityChanged,
ShaderConfig? shaderConfig,
}) {
final bool legacyParticleOverridesProvided =
particleDensity != null || particleSpeed != null || particleColor != null || maxParticleSize != null;
final bool legacyFadeOverridesProvided =
enableFadeAnimation != null || fadeRadius != null || fadeEdgeThickness != null;
final ParticleConfig? nextParticleConfig =
legacyParticleOverridesProvided ? null : (particleConfig ?? this.particleConfig);
final FadeConfig? nextFadeConfig = legacyFadeOverridesProvided ? null : (fadeConfig ?? this.fadeConfig);
return SpoilerConfig(
particleDensity: legacyParticleOverridesProvided ? (particleDensity ?? this.particleDensity) : null,
particleSpeed: legacyParticleOverridesProvided ? (particleSpeed ?? this.particleSpeed) : null,
particleColor: legacyParticleOverridesProvided ? (particleColor ?? this.particleColor) : null,
maxParticleSize: legacyParticleOverridesProvided ? (maxParticleSize ?? this.maxParticleSize) : null,
enableFadeAnimation: legacyFadeOverridesProvided ? (enableFadeAnimation ?? this.enableFadeAnimation) : null,
fadeRadius: legacyFadeOverridesProvided ? (fadeRadius ?? this.fadeRadius) : null,
fadeEdgeThickness: legacyFadeOverridesProvided ? (fadeEdgeThickness ?? this.fadeEdgeThickness) : null,
particleConfig: nextParticleConfig,
fadeConfig: nextFadeConfig,
isEnabled: isEnabled ?? this.isEnabled,
enableGestureReveal: enableGestureReveal ?? this.enableGestureReveal,
maskConfig: maskConfig ?? this.maskConfig,
onSpoilerVisibilityChanged: onSpoilerVisibilityChanged ?? this.onSpoilerVisibilityChanged,
shaderConfig: shaderConfig ?? this.shaderConfig,
);
}