copyWith method
TextSpoilerConfig
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,
- TextStyle? textStyle,
- TextSelection? textSelection,
- TextAlign? textAlign,
- int? maxLines,
- bool? isEllipsis,
override
Implementation
@override
TextSpoilerConfig 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,
TextStyle? textStyle,
TextSelection? textSelection,
TextAlign? textAlign,
int? maxLines,
bool? isEllipsis,
}) {
final bool legacyParticleOverrides =
particleDensity != null || particleSpeed != null || particleColor != null || maxParticleSize != null;
final ParticleConfig nextParticleConfig = particleConfig ??
(legacyParticleOverrides
? 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 legacyFadeOverrides = enableFadeAnimation != null || fadeRadius != null || fadeEdgeThickness != null;
final FadeConfig? nextFadeConfig = fadeConfig ??
(legacyFadeOverrides
? ((enableFadeAnimation ?? (this.fadeConfig != null))
? FadeConfig(
padding: fadeRadius ?? (this.fadeConfig?.padding ?? 10.0),
edgeThickness: fadeEdgeThickness ?? (this.fadeConfig?.edgeThickness ?? 20.0),
)
: null)
: this.fadeConfig);
return TextSpoilerConfig(
particleConfig: nextParticleConfig,
fadeConfig: nextFadeConfig,
isEnabled: isEnabled ?? this.isEnabled,
enableGestureReveal: enableGestureReveal ?? this.enableGestureReveal,
maskConfig: maskConfig ?? this.maskConfig,
onSpoilerVisibilityChanged: onSpoilerVisibilityChanged ?? this.onSpoilerVisibilityChanged,
textStyle: textStyle ?? this.textStyle,
textSelection: textSelection ?? this.textSelection,
textAlign: textAlign ?? this.textAlign,
maxLines: maxLines ?? this.maxLines,
isEllipsis: isEllipsis ?? this.isEllipsis,
shaderConfig: shaderConfig ?? this.shaderConfig,
);
}