svgaplayer_flutter 0.1.0 copy "svgaplayer_flutter: ^0.1.0" to clipboard
svgaplayer_flutter: ^0.1.0 copied to clipboard

outdated

The SVGAPlayer implementation of Flutter using CustomPainter.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:svgaplayer_flutter/svgaplayer_flutter.dart';

void main() => runApp(MyApp());

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> with SingleTickerProviderStateMixin {
  SVGAAnimationController animationController;

  @override
  void initState() {
    this.animationController = SVGAAnimationController(vsync: this);
    this.loadAnimation();
    super.initState();
  }

  @override
  void dispose() {
    this.animationController.dispose();
    super.dispose();
  }

  void loadAnimation() async {
    final videoItem = await SVGAParser.shared.decodeFromURL(
        "https://github.com/svga/SVGA-Samples/blob/master/kingset.svga?raw=true");
    this.animationController.videoItem = videoItem;
    this
        .animationController
        .repeat()
        .whenComplete(() => this.animationController.videoItem = null);
  }

  @override
  Widget build(BuildContext context) {
    return Container(
      child: SVGAImage(this.animationController),
    );
  }
}
32
likes
0
pub points
94%
popularity

Publisher

unverified uploader

The SVGAPlayer implementation of Flutter using CustomPainter.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, http, path_drawing, protobuf

More

Packages that depend on svgaplayer_flutter