I'm new using Rive and I want to use it in a proyect but I don't know very well how to animate it after tap, I'm using https://editor.rive.app/preview/2063-4080-flutter-puzzle-hack-project/381484?mode=animate&artboard=birb&animation=birb
I tried with this code but Throw me an error "Expected a value of type 'SMITrigger', but got one of type 'SMIBool'
I tried the bird look up after tap
class GlassCard extends StatefulWidget {
const GlassCard({super.key});
@override
State<GlassCard> createState() => _GlassCardState();
}
class _GlassCardState extends State<GlassCard> {
String animation = 'idle';
//animation
Artboard? _birdArtboard;
SMITrigger? trigger;
StateMachineController? stateMachineController;
@override
void initState() {
super.initState();
rootBundle.load('assets/bird.riv').then(
(data) {
final file = RiveFile.import(data);
final artboard = file.mainArtboard;
stateMachineController =
StateMachineController.fromArtboard(artboard, "birb");
if (stateMachineController != null) {
artboard.addController(stateMachineController!);
trigger = stateMachineController!.findSMI('look up');
for (var e in stateMachineController!.inputs) {
debugPrint(e.runtimeType.toString());
debugPrint("name ${e.name} End");
}
trigger = stateMachineController!.inputs.first as SMITrigger;
}
setState(() => _birdArtboard = artboard);
},
);
}
void lookup() {
trigger?.fire();
}
@override
Widget build(BuildContext context) {
return Center(
child: SizedBox(
height: 400,
width: 400,
child: _birdArtboard == null
? const SizedBox()
: Center(
child: GestureDetector(
onTap: () {
lookup();
},
child: Rive(artboard: _birdArtboard!),
),
),
),
);
}
}
Thank you