mirror of
https://github.com/rive-app/rive-flutter.git
synced 2025-11-09 17:47:43 +08:00
Expose methods to easily get Rive state machine inputs
Our current API is quite verbose and requires casting to the relevant class types when using the current find API. These methods simplify the process. Diffs= 1460f5366 Expose methods to easily get Rive state machine inputs (#7085) Co-authored-by: Gordon <pggordonhayes@gmail.com>
This commit is contained in:
@ -16,8 +16,8 @@ class _ExampleStateMachineState extends State<ExampleStateMachine> {
|
||||
|
||||
Artboard? _riveArtboard;
|
||||
StateMachineController? _controller;
|
||||
SMIInput<bool>? _hoverInput;
|
||||
SMIInput<bool>? _pressInput;
|
||||
SMIBool? _hoverInput;
|
||||
SMIBool? _pressInput;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@ -37,8 +37,8 @@ class _ExampleStateMachineState extends State<ExampleStateMachine> {
|
||||
StateMachineController.fromArtboard(artboard, 'Button');
|
||||
if (controller != null) {
|
||||
artboard.addController(controller);
|
||||
_hoverInput = controller.findInput('Hover');
|
||||
_pressInput = controller.findInput('Press');
|
||||
_hoverInput = controller.getBoolInput('Hover');
|
||||
_pressInput = controller.getBoolInput('Press');
|
||||
}
|
||||
setState(() => _riveArtboard = artboard);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user