
* chore(rive_native): remove unneeded files for pub publish * chore(rive_flutter): release 014.0-dev.6 Nnnnn add datatypes to viewmodel instances (#10357) 3b0e14f50f * feature: add data types to instance runtime values * fix: validate type when returned from cache Fix race condition in Metal background shader compiler (#10355) 92de3f0a1a * Fix race condition in Metal background shader compiler Setting an atomic variable outside of a std::condition_variable's corresponding mutex and then notifying the condition_variable has a subtle race condition, and the ordering of operations looks like this: Thread A: acquire mutex Thread A: check m_shouldQuit // it's false Thread B: m_shouldQuit = true Thread B: m_workAddedCondition.notify_all() // nothing is currently waiting on it so this does nothing Thread A: m_workAddedCondition.wait() // now it's waiting, having just missed the above notification Now thread A will wait forever because no more notifies to the condition_variable are coming and, in the case of this code, the call to m_compilerThread.join() will also wait forever (since the thread will never quit), so shutting down the renderer will never finish. Instead, m_shouldQuit should only be set to true while in the mutex (because the check of its value and the subsequent .wait call also happen within the mutex, so this prevents them interleaving). This change fixes this. * Minor formatting adjustment to make the github workflow tests re-run feat(RiveRenderer): Gamma Space Conversion (#10361) a61202f1c4 * Added conversion from gamma to linear space for situations where we can't control what our render target format is * comment update Guard against percent margins on top level artboards (#10356) aef45767df We need to prevent percent margin from being set on Artboards because percent margin relies on the layout parent's dimensions. Since an Artboard has no parent, it results in an error within Yoga and a crash. Feature: scripted data inputs (#10339) 8693175cee * chore: reworking inputs and properties * chore: syncing rive_native fixes * feature: adding script input parameters * feature: adding listeners * chore: missed files * feature: add/remove listeners * chore: updating to latest luau * chore: fix tests & colliding names * fix: missing import * chore: fix warnings * feature: guard against change during iteration * chore: fix boolean warning * fix: handle error reports from builtin types make more constraint values bindable (#10351) 9674376769 feature: add support for custom enum properties (#10345) 21b8ce84f4 * feature: add enum custom property support fix: Work around a bug in the Mali T720 compiler (#10340) 59aa55b5d0 fix: treat artboard as layout for hit testing inheritance (#10341) 583274d7b9 * fix: treat artboard as layout for hit testing inheritance feature: add support for firing triggers on state transitions (#10329) cc34f96631 * feature: add support for fiiring triggers on state transitions add support to data bind solos by index and name (#10337) 64f828c9a2 Support for Triggers in Custom property groups (#10322) 9af6af0361 Adds support for Triggers in Custom Property Groups. This will allow triggers to be keyframed, which can also be bound to ViewModel triggers. Currently an event has to be fired on the timeline in order to fire a ViewModel trigger via a listener. Update unit test build/run scripts to use build_rive.sh (#10320) 4bd8c63b93 * Update unit test scripts to use build_rive.sh The unit test test.bat and test.sh were doing their own ad-hoc building instead of using build_rive. This updates test.sh to call build_rive.sh for the build. This script could probably be pared down further but I did not want to break any of the existing command line arguments that people are probably using. Additionally, test.bat did not have up-to-date build flags in it, so now it does a similar Windows development environment setup to build_rive.bat and then calls directly into test.sh, so it won't get out of sync with the main script anymore. * Additional test.sh changes - There was a block of code that I could have removed but didn't (made redundant by the call to build_rive) - Add build_rive's parent directory to the path before calling it (will fix the test failing on Linux) - Removed the `sh` before build_rive.sh as it does not need to be shell invoked. * The pr_unit_tests.yaml execution for Mac needed to do a clean furing the asan build because it had already done a build without asan before, the change to build_rive means that we now catch the premake parameter change (adding asan), and so clean needs to happen for that build to be correct. * For now, move the build_rive.sh call into the two branches that previously had the build calls (linux, for instance, does not build, which seems incorrect given the github workflow is trying to run it. * Adding a note to test.sh to describe why the build_rive script is called in the way it is (vs. the obvious way) * Additional unit test script fixes (unifying windows build further, and some warnings) - Add the ability to specify a toolset on the command line (i.e. "--toolset=msc") that will get passed along to build_rive (thus making the 'clang' toolset in the windows build only a default) - Update the unit_test_windows and unit_test_windows_msvc entries in the github unit test workflows to call test.bat now (which required combining the build/run steps, but this matches all the other configurations) - Also added some additional parameter validation, mainly warnings on ignored/unsupported parameters Co-authored-by: Gordon <pggordonhayes@gmail.com>
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'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
- 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.