我在flutter中创建了一个FloatingActionButton来共享用户个人资料。每当用户单击该按钮时,我都希望显示一个小的眩光动画。我正在使用此代码,但正在显示动画。动画文件为Congratulations.flr
Tooltip(
message: "Share with friends",
child: new FloatingActionButton(
heroTag: null,
backgroundColor: primaryColor,
child: Icon(Icons.share),
onPressed: () {
FlareActor(
'assets/videos/Congratulations.flr',
alignment: Alignment.center,
fit: BoxFit.contain,
animation: 'animate',
);
shareUserProfile();
},
),
),
答案 0 :(得分:0)
您必须将FlareActor放在要显示它的位置onPressed方法之外,然后在状态更改后启动它。
下面是有关如何执行此操作的优秀教程的链接
希望这对您有所帮助。