Merged
Conversation
This commit upgrades the Rive package from `^0.13.5` to the development version `^0.14.0-dev.11`. As part of this upgrade, the plugin registration name has changed from `rive_common` to `rive_native` across all supported platforms (Linux, macOS, and Windows). The generated plugin registration files have been updated accordingly.
The Rive asset has been updated in the editor to leverage **data bindings** for properties and **state machine inputs** for state tracking, replacing the older implementation style. This change aligns the asset with the best practices of the new Rive API, making it easier to manage complex property changes and state transitions in the Flutter application.
This commit refactors the `GameButton` widget to use the modern Rive API, replacing the old direct animation control with `RiveWidget` and `RiveWidgetController`.
Key changes include:
* **API Switch:** Replaced `RiveAnimation.direct` with `RiveWidget`.
* **Controller:** Switched from `StateMachineController` to the unified `RiveWidgetController`.
* **Asset Loading:** Updated asset loading from `RiveFile.import` to the new asynchronous `File.decode`.
* **Text & State Handling:** Migrated to the new **data binding** and **state machine input** listeners (`controller.dataBind`, `viewModelInstance.string('currentState')`) for setting button text and handling press/rest states, removing boilerplate manual controller management.
This commit refactors the background animation on the `LevelCompletePage` to use the new Rive API pattern. The `LevelCompletePage` has been converted from a `StatelessWidget` to a `StatefulWidget` to manage the asynchronous asset loading lifecycle. Key changes: * **Widget Switch:** Replaced `RiveAnimation.asset` with `RiveWidget`. * **Asset Loading:** Switched to the asynchronous `File.asset` and managed its state via `initState` and an `isInitialized` flag, displaying a loading indicator until ready. * **Resource Management:** Added proper disposal of `File` and `RiveWidgetController` in `dispose()`. * **Navigation Fix:** Updated the next level navigation to correctly access `levelData` via `widget.levelData`.
…Machine API
This commit refactors the Rive animation implementation within the `Hint` widget to align with the new Rive API.
Key changes:
* **Widget & Controller:** Replaced `RiveAnimation.direct` with `RiveWidget` and introduced `RiveWidgetController` for unified management.
* **Asset Loading:** Migrated from `RiveFile.import` to the modern asynchronous `File.decode`.
* **Input Access:** Switched from `StateMachineController.fromArtboard` and casting `SMIBool` to the simpler, direct access pattern using `artboard.stateMachine('name')` and `stateMachine.boolean('input')`.
* **Input Modification:** Replaced the imperative `change()` method on inputs with the direct value assignment using `input.value = ...`.
* **Resource Management:** Added disposal of the `RiveWidgetController` and all related Rive objects (`StateMachine`, `BooleanInput`) in the `dispose()` method for memory safety.
This commit removes the `lib/core/extensions/rive_extensions.dart` file. The `TextExtension` became obsolete after migrating the Rive implementations (specifically `GameButton`) to the new API's built-in text functionality (`artboard.setText`) instead of using the custom extension to find `TextValueRun` components.
This commit finalizes the Rive migration by updating the asset initialization in `bootstrap.dart`. The older `RiveFile.initialize()` has been replaced with the new, platform-specific `RiveNative.init()` to properly set up the native Rive rendering environment. Additionally, `WidgetsFlutterBinding.ensureInitialized()` was added before the Rive and HydratedBloc initialization to ensure the necessary service bindings are available.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Type of Change