dotlottie_loader

Creator: coderz1093

Last updated:

0 purchases

dotlottie_loader Image
dotlottie_loader Images

Languages

Categories

Add to Cart

Description:

dotlottie loader

dotLottieLoader for Flutter #

dotLottieLoader is a library to help downloading and deflating a .lottie file, giving access to the animation,
as well as the assets included in the bundle. This repository is an unofficial conversion of the dotottieloader-android library in pure Dart.
It works on Android, iOS, macOS, linux, windows and web.
Install #
flutter pub add dotlottie_loader
copied to clipboard
Also install lottie package to render the animations.
Usage #
loading from app assets
DotLottieLoader.fromAsset("assets/anim2.lottie",
frameBuilder: (BuildContext ctx, DotLottie? dotlottie) {
if (dotlottie != null) {
return Lottie.memory(dotlottie.animations.values.single);
} else {
return Container();
}
}),
copied to clipboard
loading from network
DotLottieLoader.fromNetwork(
"https://github.com/sartajroshan/dotlottieloader-flutter/raw/master/example/assets/animation.lottie",
frameBuilder: (ctx, dotlottie) {
if (dotlottie != null) {
return Lottie.memory(dotlottie!.animations.values.single);
} else {
return Container();
}
},
errorBuilder: (ctx, e, s) {
print(s);
return Text(e.toString());
},
),
copied to clipboard
loading with images
DotLottieLoader.fromAsset(
"assets/animation_external_image.lottie",
frameBuilder: (ctx, dotlottie) {
if (dotlottie != null) {
return Lottie.memory(dotlottie.animations.values.single,
imageProviderFactory: (asset) {
return MemoryImage(dotlottie.images[asset.fileName]!);
},
);
} else {
return Container();
}
},
)
copied to clipboard
DotLottie data
class ManifestAnimation {
String id;
double speed;
String? themeColor;
bool loop;

ManifestAnimation(this.id, this.speed, this.themeColor, this.loop);
}

class Manifest {
String? generator, author;
int? revision;
String? version;
late List<ManifestAnimation> animations;
Map<String, dynamic>? custom;

Manifest(this.generator, this.author, this.revision, this.version,
this.animations, this.custom);
}

class DotLottie {
Manifest? manifest;
Map<String, Uint8List> animations;
Map<String, Uint8List> images;

DotLottie(this.manifest, this.animations, this.images);
}
copied to clipboard
View documentation, FAQ, help, examples, and more at dotlottie.io #

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.