Rive Flutter-Laufzeit. Dieses Paket bietet Laufzeitfunktionen für Rive-Grafiken, die mit dem Rive-Editor erstellt wurden, der unter https://rive.app verfügbar ist
Aus öffentlichen Paketdaten erstellte Orientierung.
Rive ist ein Flutter-Paket, das die Laufzeitwiedergabe interaktiver Animationen und Grafiken ermöglicht, die mit dem Rive-Editor erstellt wurden. Es ermöglicht Entwicklern, reibungslose, leichte Vektoranimationen in ihre Apps auf mehreren Plattformen zu integrieren. Das Paket unterstützt Echtzeit-Animationswiedergabe, Zustandsverwaltung und responsive Design, was es ideal für dynamische Benutzeroberflächen und Game-Assets macht. Mit Unterstützung für Android, iOS, Web, macOS, Windows und Linux sorgt Rive für konsistente Leistung und visuelle Treue. Es wurde für eine nahtlose Integration in Flutter-Anwendungen mit einfachen APIs entwickelt.
Anwendungsfälle
interaktive App-Schnittstellen
Spielcharakteranimationen
Ladeanzeiger
Onboarding-Erfahrungen
Animierte Schaltflächen
Micro-interactions
Hauptmerkmale
vektorbasierte Animationen
Echtzeit-Wiedergabe
Zustandsmaschinenunterstützung
Plattformübergreifende Kompatibilität
Leistungsstark
Einfache Flutter-Integration
Geeignet für
UI/UX-Designer
Spieleentwickler
Entwickler mobiler Apps
Webentwickler
animationsorientierte Projekte
Interaktive Prototypen
Hinweise
Benötigt den Rive-Editor für die Erstellung von Assets
Beschränkt auf Rive-Dateiformat (.riv)
Möglicherweise ist das Erlernen des Animationssystems von Rive erforderlich
Die Leistung hängt von der Komplexität der Animation ab
Nicht geeignet für statische Bilder
Am besten mit Rive-kompatiblen Design-Workflows verwenden
Original-README
Originaler README-Schnappschuss aus dem verknüpften Quell-Repository. Aktuelle Inhalte finden Sie im Repository.
Rive Flutter
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.
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:
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 appcd 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:
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 = (awaitFile.asset(
'assets/rewards.riv',
// Choose which renderer to use
riveFactory: Factory.rive,
))!;
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:
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
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.
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.
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:
Run flutter clean
Run flutter pub get
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.