搜索插件、代码仓与 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),
)

所属分类

源码仓库

使用此插件的项目

暂无相关数据。