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

flutter_numeric_text 封面
套件詳情v1.3.3

flutter_numeric_text

此組件可讓您對任何文字進行動畫處理。該組件易於使用,可輕鬆將 Text(data) 替換為 NumericText(data)。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
945
喜歡數
28
Pub 分數
160

安裝套件

flutter pub add flutter_numeric_text

套件介紹

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

flutter_numeric_text 是一個 Flutter 套件,可為文字顯示啟用平滑的數字動畫。它以帶有動畫效果的數字過渡取代標準的 Text 小工具,非常適合計數器、分數或任何隨時間變化的數值。該小工具易於整合——只需將 Text(data) 替換為 NumericText(data)—並支援所有主要平台,包括 Android、iOS、Web、macOS、Windows 和 Linux。它提供無縫的視覺體驗,設定簡單,非常適合需要流暢數字更新的動態 UI 元素。

適用情境

  • 動畫計數器
  • 分數顯示
  • 動態資料視覺化
  • 即時數字更新
  • 互動式儀表板

主要特色

  • 平滑數值動畫
  • 簡單 API 替代
  • 跨平台支援
  • 最小設定
  • 可自訂速度
  • 自動數字處理

適合對象

  • 需要動畫數字的開發人員
  • UI設計師提升儀表板
  • 具有即時指標的應用程式
  • 遊戲化功能
  • 簡單而精緻的動畫

使用建議

  • 最適合數值類型
  • 可能影響效能於高頻率更新
  • 限於整數和小數
  • 不適用於非數字文字
  • 需要仔細調整以適應非常快速的更新

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

Text(data) → NumericText(data)

This widget allows you to animate any text. The animation is reminiscent of the text animation in SwiftUI's .numericText(value:). The widget is easy to use and allows you to seamlessly replace Text(data) with NumericText(data).

Features

  • Automatic text animation
  • Minimal configuration required to get started
  • Supports almost all parameters of the Text() widget
  • No external dependencies required

Usage

import 'package:flutter_numeric_text/flutter_numeric_text.dart';

class MyWidget extends StatelessWidget {
  const MyWidget({super.key});

  @override
  Widget build(BuildContext context) {
    // Simply add the widget, and when its value changes,
    // it will automatically trigger the animation.

    // To use the widget, you only need to provide
    // a data value, other fields are optional.

    NumericText(
      "12345 or text",
      duration: const Duration(milliseconds: 300),
      style: const TextStyle(fontSize: 24, color: Colors.black),
      textAlign: TextAlign.center,
      textDirection: TextDirection.ltr,
      locale: const Locale("en", "US"),
      softWrap: true,
      overflow: TextOverflow.ellipsis,
      maxLines: 1,
      semanticsLabel: "Numeric value",
    );
  }
}
With GoogleFonts
...
    NumericText(
      "12345 or text",
      duration: const Duration(milliseconds: 300),
      style: GoogleFonts.<your_font>(
        fontSize: 24,
        color: Colors.black,
        // Just a friendly reminder to add the [textStyle] field.
        // It'll make sure everything calculates correctly.
        textStyle: Theme.of(context).textTheme.bodyMedium,
      ),
    );
...

Installation

To use this package, add it to your pubspec.yaml file:

dependencies:
  flutter_numeric_text: ^1.0.0 # Replace with the latest version

Contributing

Contributions are welcome! If you have suggestions for improvements or find bugs, please open an issue or submit a pull request.

License

This project is licensed under the MIT License. See the LICENSE file for details.

所屬分類

原始碼儲存庫

使用此套件的專案

暫無相關資料。