Skip to content

Package for animated text in Flutter. Useful for currency value increase/decrease value animation or text contents lerp animation.

License

Notifications You must be signed in to change notification settings

SilentCatD/animated_text_lerp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pub package

Simple widgets to animate between number or string text. Useful for number increase/decrease animation, currency value animation or string content changing animation.

Features

  • Similar to a simple Text widget.
  • Animating between number (int or double) with AnimatedNumberText.
  • Animating between string, which will lerp each character respectively with AnimatedStringText.
  • TextStyle animation supported.
  • Think of Flutter's pre-built animated widget like AnimatedOpacity, AnimatedAlign, ..., but with text.

Getting started

  • First import it:
import 'package:animated_text_lerp/animated_text_lerp.dart';

Usage

AnimatedNumberText

The widget support lerping between number values. Just setState with the current value and the widget will start animating to it.

AnimatedNumberText(
  value, // int or double
  curve: Curves.easeIn,
  duration: const Duration(seconds: 1),
  style: const TextStyle(fontSize: 30),
  formatter: (value) {
    final formatted =
    intl.NumberFormat.currency(locale: "en").format(value);
    return formatted;
  },
)

AnimatedStringText

The widget support lerping between string values. Just setState with the current value and the widget will start animating to it. Each character will lerp to the new corresponding one respectively.

AnimatedStringText(
  value, // string
  curve: Curves.easeIn,
  duration: const Duration(seconds: 1),
  style: const TextStyle(fontSize: 30),
)

About

Package for animated text in Flutter. Useful for currency value increase/decrease value animation or text contents lerp animation.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages