* chore(flutter): remove old build scrips * chore(flutter): fix analyzer warnings * chore(flutter): update rive_native 0.0.4 * docs(flutter): update readme to point to legacy code List virtualization hit testing 3 (#10157) 8b7aa84704 * feat: propagate hit tests up in the component tree to detect if they are hitting a clipped area Fix bug with Artboard ScaleType in Lists (#10159) 8251f1b259 Fixes a bug when databinding scale type to Artboards used in Lists due to the created Artboard not knowing what it's parent's main layout axis was. We need to pass it down as soon as the artboard is created. List fixes 2 (#10153) 8749deb70a When virtualizing lists, there were some issues with instanced artboards not rendering correctly until the following frame. This fixes that issue, as addresses similar 1 frame delayed layout updates particularly when using nested artboards fix: only shape text with modifiers if the shapes are not empty (#10147) 95bf14f49b fix: include missing header for randomization (#10126) 099266fec8 fix: change keys to rcp to avoid memory issues (#10146) 11042e5b4c change keys to rcp to avoid memory issues List virtualization fixes (#10143) bf3b33a30a First round of fixes for List Virtualization/Carousel Fix layout flicker when adding a new artboard using virtualization Fix hit detection Fix scroll snapping not working properly in Carousel mode Fix z-index issue with Carousel when items wrapped around from end to start. Fix a transform issue found by @JcToon Nnnn data biinding artboard fixes (#10139) e54d2ba962 * update overrides when artboard changes * add nested artboard as hit component even if it does not have state machines to support data binding * when adding a new item to a list, use the previous view model from the list as source if it exists feature: scripting require (#10133) 496fa2b490 * fix: working on dependent imports * feature: add full problem report to wasm * feature: runtime require * feature: scripting require * chore: remove string_view * chore: assert instead of runtime error * chore: fix warning on windows * chore: fix memory leak * chore: fix unused var * chore: more windows warnings * chore: fix dart code_core tests * fix: missing bool in FFI setScriptSource List Virtualization & Scroll Carousel (#9965) d973e8c253 Add support for List virtualization as well as a parameter to the ScrollConstraint to support infinite scrolling (Carousel). There are important caveats with Virtualization enabled: The List instances enough artboards to fit into their parent's bounds and when not rendered, they are pooled and reused as necessary. Lists can be non-uniform meaning they can consist of more than 1 Artboard (ViewModel) type Does not currently work when its parent is set to wrap because more complex computations may result when wrapping In order to use Carousel, virtualization must also be enabled Infinite scroll only works in a single direction, not both at the same time feat(apple): add support for data binding list properties (#9936) d2997eeef4 feat: nested artboards -> components (#10082) 7379bdd49f * publishable mixin * only show components in nested artboard list * updates * icons… * icons * change increment to boolean * remove lib component keys in ext * remove icons * flag * remove `didPublish` property * get this library * fix ups * test fixes * flag inspcetor icons * move publishable to custom enums * tool icon fix * extra flags * use resolver to check if nestable * panel sizes * regen keys * panel width core default value Co-authored-by: Gordon <pggordonhayes@gmail.com>
7.0 KiB
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.
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
To get started with Rive Flutter, check out the following resources:
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 rendererFactoy.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:
- 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.
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:
- 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:
flutter clean # Important
dart run rive_native:setup --verbose --clean --build --platform macos
Note
: Building the libraries requires specific tooling on your machine. Additional documentation will be provided soon.
Testing
Shared libraries are included in the download/build process. 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
- Reach out to us on our Community
- File an issue on the Rive Flutter repository
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.