AnimatedText constructor

const AnimatedText({
  1. Key? key,
  2. String text = 'Animated Text',
  3. SplitType splitType = SplitType.char,
  4. Curve curve = Curves.bounceIn,
  5. double fontSize = 64,
  6. AnimationType animationType = AnimationType.fade,
  7. Duration duration = const Duration(milliseconds: 500),
  8. bool autoPlay = true,
  9. double blurFactor = 100,
})

Crea un AnimatedText.

text es el texto a animar.

splitType define cómo se divide el texto (caracteres, palabras o líneas).

animationType define el tipo de animación a aplicar.

curve es la curva de animación que se aplicará a cada elemento.

duration es la duración base de cada elemento. Cada elemento subsecuente añade 100ms adicionales para crear un efecto de cascada.

autoPlay determina si la animación inicia automáticamente al montar el widget.

fontSize es el tamaño de la fuente del texto.

blurFactor controla la intensidad del desenfoque cuando se usa AnimationType.blur.

Para controlar la animación manualmente, usa un GlobalKey y llama a AnimatedTextState.play().

Ejemplo

AnimatedText(
  text: 'Hello World',
  splitType: SplitType.char,
  animationType: AnimationType.fade,
  curve: Curves.easeOut,
  duration: Duration(milliseconds: 500),
  fontSize: 32,
  autoPlay: true,
)

Control manual

final GlobalKey<AnimatedTextState> textKey = GlobalKey();

AnimatedText(
  key: textKey,
  text: 'Animated Text',
  autoPlay: false,
)

// Para lanzar la animación:
textKey.currentState?.play();

Implementation

const AnimatedText({
  super.key,
  this.text = 'Animated Text',
  this.splitType = SplitType.char,
  this.curve = Curves.bounceIn,
  this.fontSize = 64,
  this.animationType = AnimationType.fade,
  this.duration = const Duration(milliseconds: 500),
  this.autoPlay = true,
  this.blurFactor = 100,
});