void initState() {
this.animationController = SVGAAnimationController(vsync: this);
this._loadAnimation();
super.initState();
}
Widget build(BuildContext context) {
return Container(
width: 40,
height: 20,
child:SVGAImage(this.animationController),
)};
}
_loadAnimation() async {
final videoItem = await SVGAParser.shared.decodeFromAssets(
"assets/svga/first_consume_bg.svga");
this.animationController.videoItem = videoItem;
this
.animationController
.repeat()
.whenComplete(() => this.animationController.videoItem = null);
}
.yaml
assets:
- assets/svga/first_consume_bg.svga
加载本地文件无效,无报错信息,不显示