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

rive 封面
套件詳情v0.14.11

rive

Rive Flutter 執行時期。此套件為使用 Rive 編輯器(可於 https://rive.app 取得)建立的 Rive 圖形提供執行時期功能。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
55.2萬
喜歡數
1950
Pub 分數
140

安裝套件

flutter pub add rive

套件介紹

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

Rive 是一個 Flutter 套件,可實現使用 Rive 編輯器建立的互動式動畫與圖形之執行時渲染。它讓開發者能夠將流暢、輕量級的向量動畫整合至他們跨多個平台的應用程式中。該套件支援即時動畫播放、狀態管理與響應式設計,非常適合動態介面與遊戲資源。Rive 支援 Android、iOS、Web、macOS、Windows 與 Linux,確保一致的效能與視覺保真度。它專為與 Flutter 應用程式無縫整合而設計,使用簡單的 API。

適用情境

  • 互動式應用程式介面
  • 遊戲角色動畫
  • 載入指示器
  • 入門體驗
  • 動畫按鈕
  • Micro-interactions

主要特色

  • 基於向量的動畫
  • 即時播放
  • 狀態機支援
  • 跨平台相容性
  • 輕量級效能
  • 輕鬆整合 Flutter

適合對象

  • UI/UX 設計師
  • 遊戲開發者
  • 行動應用程式開發者
  • Web 開發人員
  • 以動畫為重點的專案
  • 互動式原型

使用建議

  • 資產創建需要 Rive 編輯器
  • 限制為 Rive 檔案格式 (.riv)
  • 可能需要學習 Rive 的動畫系統
  • 性能取決於動畫的複雜程度
  • 不適用於靜態圖像
  • 最佳搭配 Rive 相容的設計工作流程使用

原始 README

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

Pub Version Build Status Discord badge Twitter handle

Rive Flutter

Rive hero image

Rive Flutter is a runtime library for Rive, a real-time interactive design tool.

This library allows you to fully control Rive files in your Flutter apps and games.

Table of contents

Overview of Rive

Rive combines an interactive design tool, a new stateful graphics format, a lightweight multi-platform runtime, and a blazing-fast vector renderer. This end-to-end pipeline guarantees that what you build in the Rive Editor is exactly what ships in your apps, games, and websites.

For more information, check out the following resources:

Getting started

See the Getting Started with Rive in Flutter documentation.

Example App

The rive package depends on rive_native, and the code on GitHub may reference an unpublished version of rive_native. To run the example app, we recommend using the published version from Pub unless you intend to build the native libraries locally (see Building rive_native).

dart pub unpack rive        # Unpack the package source code and example app
cd rive/example             # Navigate to the example folder
flutter create .            # Create the platform folders
flutter pub get             # Fetch dependencies
flutter run                 # Run the example app

For more information, see the Runtime sections of the Rive help documentation:

Choosing a Renderer

In Rive Flutter you have the option to choose either the Rive renderer, or the renderer that is used in Flutter (Skia or Impeller).

You choose a desired renderer when creating a Rive File object. All graphics that are then created from this File instance will use the selected renderer.

final riveFile = (await File.asset(
  'assets/rewards.riv',
  // Choose which renderer to use
  riveFactory: Factory.rive,
))!;

Options:

  • Factory.rive for the Rive renderer
  • Factoy.flutter for the Flutter renderer

For more information and additional consideration, see Specifying a Renderer.

Note on the Impeller renderer

Starting in Flutter v3.10, Impeller has replaced Skia to become the default renderer for apps on the iOS platform and may continue to be the default on future platforms over time. As such, there is a possibility of rendering and performance discrepencies when using the Rive Flutter runtime with platforms that use the Impeller renderer that may not have surfaced before. If you encounter any visual or performance errors at runtime compared to expected behavior in the Rive editor, we recommend trying the following steps to triage:

  1. Try running the Flutter app with the --no-enable-impeller flag to use the Skia renderer. If the visual discrepancy does not show when using Skia, it may be a rendering bug on Impeller. However, before raising a bug with the Flutter team, try the second point below👇
flutter run --no-enable-impeller
  1. Try running the Flutter app on the latest master channel. It is possible that visual bugs may be resolved on the latest Flutter commits, but not yet released in the beta or stable channel.
  2. If you are still seeing visual discrepancies with just the Impeller renderer on the latest master branch, we recommend raising a detailed issue to the Flutter Github repo with a reproducible example, and other relevant details that can help the team debug any possible issues that may be present.

Supported platforms

Platform Flutter Renderer Rive Renderer
iOS ✅ ✅
Android ✅ ✅
macOS ✅ ✅
Windows ✅ ✅
Linux ✅ ✅
Web ✅ ✅

Be sure to read the platform specific considerations for the Rive Flutter package.

Awesome Rive

For even more examples and resources on using Rive at runtime or in other tools, checkout the awesome-rive repo.

Troubleshooting

The required native libraries should be automatically downloaded during the build step (flutter run or flutter build). If you encounter issues, try the following:

  1. Run flutter clean
  2. Run flutter pub get
  3. Run flutter run

Alternatively, you can manually run the rive_native setup script. In the root of your Flutter app, execute:

dart run rive_native:setup --verbose --clean --platform macos

This will clean the rive_native setup and download the platform-specific libraries specified with the --platform flag. Refer to the Platform Support section above for details.

Building rive_native

By default, prebuilt native libraries are downloaded and used. If you prefer to build the libraries yourself, use the --build flag with the setup script. In the root of your Flutter app:

flutter clean # Important
flutter pub get
dart run rive_native:setup --verbose --clean --build --platform macos

See Building rive_native in the official docs for the required tooling per platform, supported --platform values, web specifics, and how to return to the prebuilt libraries.

Testing

Shared libraries are included in the download/build process. If you've done flutter run on the native platform, the libraries should already be available.

Otherwise, manually download the prebuilt libraries by doing:

dart run rive_native:setup --verbose --clean --platform macos

Specify the desired --platform, options are macos, windows, and linux.

Now you can run flutter test.

Optionally build the libraries if desired:

dart run rive_native:setup --verbose --clean --build --platform macos

If you encounter issues using rive_native in your tests, please reach out to us for assistance.

Contributing

We love contributions and all are welcome! 💙

Issues

Rive Flutter Legacy Runtime

You can find the old runtime code here: https://github.com/rive-app/rive-flutter-legacy

The last published Pub release for this code is rive: 0.13.20.

The majority of the new runtime code now lives in the rive_native package.

所屬分類

依賴

依賴清單 1 項

原始碼儲存庫

使用此套件的專案