搜尋套件、儲存庫與 APP 分類

animated_text_lerp 封面
套件詳情v2.0.0

animated_text_lerp

用於在數字或字串文字之間進行動畫的簡單小工具。適用於數字增減動畫、貨幣價值動畫或字串內容變更動畫。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
2050
喜歡數
60
Pub 分數
150

安裝套件

flutter pub add animated_text_lerp

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

AnimatedTextLerp 是一個 Flutter 套件,提供簡單的組件來平滑地動畫數字或字串值之間的轉換。它能為動態文字實現流暢的過渡效果,例如遞增或遞減的數字、貨幣更新,或具有視覺連續性的文字內容變更。適用於儀表板、計數器和即時資料顯示,利用插值(lerp)實現平滑的視覺效果,無需複雜的動畫。此套件支援所有主要平台,包括 Android、iOS、Web、macOS、Windows 和 Linux。

適用情境

  • 即時數字計數器
  • 貨幣值更新
  • 動態文字過渡
  • 儀表板指標
  • 載入進度指示器
  • 動畫統計

主要特色

  • 基於 lerp 的平滑動畫
  • 同時支援數字和字串
  • 所需的設定最少
  • 跨平台相容性
  • 可自訂的持續時間和曲線
  • 內建的緩動函數

適合對象

  • 簡單的動畫計數器
  • 資料視覺化組件
  • 使用者介面增強
  • 教育類應用
  • 財務儀表板

使用建議

  • 不適合複雜的動畫
  • 超出基本屬性的自訂功能有限
  • 最適合小規模文字變更
  • 高頻率更新可能影響效能
  • 需要仔細處理字串格式化

原始 README

以下為關聯原始碼儲存庫的 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

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

所屬分類

原始碼儲存庫

使用此套件的專案

暫無相關資料。