Comments (4)
Could not find exmaple for
Lottie.file(file)
can you please provide one
from lottie-flutter.
Hi, thanks for your interest in this library
There is the LottieComposition.fromBytes
getter that allows to load a lottie composition from a list of bytes (loaded from the network for instance).
Future<LottieComposition> _loadComposition() async {
var response = await get('<url>'); // from the "http" library
return LottieComposition.fromBytes(response.bodyBytes);
}
And you display the LottieComposition
with the Lottie
constructor:
@override
Widget build(BuildContext context) {
return FutureBuilder<LottieComposition>(
future: _futureComposition,
builder: (context, snapshot) {
if (snapshot.hasError) return ErrorWidget(snapshot.error);
if (snapshot.data == null) return CircularProgressIndicator();
return Lottie(composition: snapshot.data);
},
);
}
Also there is the Lottie.memory
constructor that may help you.
The Lottie.file
is very easy to use.
There is this example that saves and load lottie animation to files in a "temp" directory.
from lottie-flutter.
Thank you. It's working now.
In my app user can choose subject
it opens subject page which loads lottie files from remote(in avarage 10-15 lottie files)
and user can swipe left right to see lottie animations
one problem is
first animations start from beginning
but when user swipe to next,prev animation it starts not from beginning
there is a way to start from beginning right?
By the way any tips to optimize loading and playing lottie files?
from lottie-flutter.
The recommendation is to use a custom AnimationController to have full control on how to run the animation.
from lottie-flutter.
Related Issues (20)
- Sub-dependency fails vulnerability check HOT 2
- On web only Lottie.asset work, not Lottie.network HOT 2
- Font not Rendering properly HOT 2
- There is a difference between loading on the app and HTML HOT 2
- Not working in iOS17
- Text Animation Exported with After Effects Body Movin Not Working
- Change Speed Not On Load
- Animation made through Ae 3D space is not supported
- Animation not displayed correctly HOT 8
- ValueDelegate.gradientColor Unable to continuously refresh HOT 4
- ValueDelegate.position can not change all shapes
- The gradient in my animation made with Adobe after effects doesn't work as expected. HOT 2
- add flutter 3.16 proper support and update dependencies HOT 2
- ValueDelegate.position can not change images
- Using this library will use a lot of GPUs, even if `enableRenderCache` has been used HOT 2
- Valid json with missing frames HOT 1
- Black lines appear when one animation overlaps another one
- how to Cache tgs file . HOT 1
- tgs lottie very slow on android HOT 5
- How should I playsegment? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lottie-flutter.