FLUTTER ECOSYSTEM

SilentCatD/animated_text_lerp

用於 Flutter 中動畫文字的套件。適用於貨幣價值增加/減少的動畫,或文字內容的插值動畫。

animated_text_lerp 專案封面
Stars
7
Forks
1
最近推送(UTC)
2024年12月23日
專案狀態
未封存
SilentCatDev GitHub avatar
GITHUB User

SilentCatDev ↗

MIT Licensed packages developer @ HCMUS ngocphuocnguyen312@gmail.com

Ho Chi Minh City, Viet Nam
語言Dart

此儲存庫發佈的套件

使用的依賴

依賴清單 3 項
  • flutter{"sdk":"flutter"}
  • flutter_test開發依賴{"sdk":"flutter"}
  • flutter_lints開發依賴^3.0.0

原始 README

以下為英文專案原文快照,最新內容請造訪 GitHub。

展開 / 收合專案 README

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

https://github.com/SilentCatD/animated_text_lerp/blob/main/assets/animated_number_text.gif?raw=true

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

https://github.com/SilentCatD/animated_text_lerp/blob/main/assets/animated_text.gif?raw=true

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),
)