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:
HayesGordon
2024-04-22 10:11:46 +00:00
parent 06265422cc
commit 4e2547d08d
13 changed files with 50 additions and 26 deletions

View File

@ -19,7 +19,7 @@ class _LittleMachineState extends State<LittleMachine> {
Artboard? _riveArtboard;
StateMachineController? _controller;
SMIInput<bool>? _trigger;
SMITrigger? _trigger;
@override
void initState() {
@ -42,7 +42,7 @@ class _LittleMachineState extends State<LittleMachine> {
);
if (controller != null) {
artboard.addController(controller);
_trigger = controller.findInput('Trigger 1');
_trigger = controller.getTriggerInput('Trigger 1');
}
setState(() => _riveArtboard = artboard);
},
@ -64,7 +64,7 @@ class _LittleMachineState extends State<LittleMachine> {
_riveArtboard == null
? const SizedBox()
: GestureDetector(
onTapDown: (_) => _trigger?.value = true,
onTapDown: (_) => _trigger?.fire(),
child: Rive(
artboard: _riveArtboard!,
fit: BoxFit.cover,