xvrh / lottie-flutter

Render After Effects animations natively on Flutter. This package is a pure Dart implementation of a Lottie player.
https://pub.dev/packages/lottie
MIT License
1.15k stars 197 forks source link

Fix bugs & support .tgs & .lottie #314

Closed xvrh closed 9 months ago

xvrh commented 9 months ago
Lottie.asset(
  'sticker.tgs',
  decoder: LottieComposition.decodeGZip,
)
Lottie.asset(
  'animation.lottie',
  decoder: customDecoder,
);

Future<LottieComposition?> customDecoder(List<int> bytes) {
  return LottieComposition.decodeZip(bytes, filePicker: (files) {
    return files.firstWhere((f) => f.name == 'animations/cat.json');
  });
}

Lottie.asset('anim.json', imageProviderFactory: imageProviderFactory, decoder: decoder)