Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

TextComponent shadows are not affected by OpacityEffect

Abierto
#4,013 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@spydon ya está trabajando en esto.

Desde el 8/9/2026.

  • #4042 de @Yasser-Ameur — cerrado sin fusionar
  • #4043 de @spydon — abierto
  • #4044 de @spydon — abierto

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
72/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
dart, flutter
Área
game-dev

Línea de trabajo

Comienza con TextComponent.onChanged y TextPaint.copyWithPaint, donde OpacityEffect actualiza el paint. Sigue cómo se copian TextStyle.shadows y el color de primer plano con estilo, y añade cobertura para el desvanecimiento de texto coloreado con sombras. Se considera completado cuando el texto y sus sombras se desvanecen juntos sin el cambio brusco del color inicial.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Description

When an OpacityEffect runs on a TextComponent whose TextPaint style defines shadows, the glyph color fades but the shadows keep their original alpha. The shadows stay at full strength for the whole animation, so a fading text leaves a non-fading shadow or glow behind, which reads as a visual glitch.

There is also a related gotcha in the same code path: the first time the effect updates the paint, the style's fill color is replaced entirely by the component's HasPaint paint (white by default), so a colored text visibly snaps to white when the fade begins unless the user remembers to seed paint.color with the same color as the style.

Cause

TextComponent.onChanged applies opacity through TextRenderer.copyWithPaint, and TextPaint.copyWithPaint only swaps the style's foreground:

@override
TextRenderer copyWithPaint(Paint paint) {
  return copyWith(
    (style) {
      return style.copyWith(
        foreground: paint,
      );
    },
  );
}

style.shadows is left untouched, so shadow alpha never follows the component's opacity.

Steps to reproduce

final text = TextComponent(
  text: '+1 kr',
  textRenderer: TextPaint(
    style: const TextStyle(
      color: Color(0xFF2E9940),
      shadows: [Shadow(color: Color(0x99FFFFFF), blurRadius: 4)],
    ),
  ),
)..add(OpacityEffect.fadeOut(EffectController(duration: 1)));

Expected behavior

The text and its shadows fade out together, in the text's own color.

Actual behavior

The text snaps to white when the effect starts (foreground paint replaces the style color) and fades, while the white shadow stays at constant alpha until the component is removed.

Suggested fix

In TextPaint.copyWithPaint, scale each shadow's color alpha by the incoming paint's alpha (and consider multiplying the paint color into the existing style color instead of replacing it, so OpacityEffect composes with a styled color the way it does for sprites).

Observed on the perf/component-set-backing branch, but the copyWithPaint implementation is the same on main.

Lenguaje dominante
Dart
Estrellas
10.8k
Forks
1.1k
Merge medio
1 d 15 h
PR fusionados (30 d)
50

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de flame-engine/flame

Todos los issues de flame-engine/flame

Issues similares

Más issues de Dart

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.