Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Added FlareAnimationProvider to load from different sources #48

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

PeterZainzinger
Copy link

Before it was only possible to load animations from assets, with this BREAKING change inspired by ImageProvider animations can be loaded from any source.

FlareActor(FlareCachedNetworkAnimationProvider(url: 'https://..'),...);

Open Questions

  • What does the readOutOfBandAsset do and when is it used, it does not seem to be used in any examples, to test it we need an example animation which uses this feature.
  • Should the FlareCachedNetworkAnimationProvider which introduces a dependency to flutter_cache_manager be a part of the flare_flutter package?
  • Should this be included in a major version bump since it is a breaking change?

@luigi-rosso
Copy link
Contributor

This is awesome, very excited to try it out. Thanks for your contribution!

The out of band assets is an option for how to pack the images into the exported file. Images can be packed in band (directly in the .flr file) or out of band (provided along side it in the same folder). Right now none of the examples use out of band images we don't expose the option when exporting from Flare, but it something we plan on exposing soon as there are some cases where sharing images across multiple Flare files might be desirable.

I'll try to review some of your caching questions a little later today or tomorrow, in the meantime we'll add this PR to our roadmap so we can make sure it stays on our radar this week.

Thanks again!

@jaumard
Copy link

jaumard commented Mar 22, 2019

this looks nice !!! being able to load animation from network is really interesting ! from what I've seen I miss a was to manage errors, lot of things can go wrong when playing with network requests, would be nice to have the ability to provide a fallback in case of errors for example (or a callback with the errors)

@sultanmyrza
Copy link

anage e

you are right error handling is MUST
1 quick solution I see is to reuse already existing method in flare.dart

 static Future<FlutterActor> loadFromByteData(ByteData data) async {
    //ByteData data = await context.bundle.load(context.filename);
    FlutterActor actor = FlutterActor();
    await actor.load(data, null);
    return actor;
  }

then if we can provide ByteData to flare actor
error hanling can be delegated up meaning in my dart code I will fetch http://...animation.flr
read as ByteData if no error I pass it to Flare actor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants