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

Add Lottie integration #298

Merged
merged 15 commits into from
Sep 28, 2022
Merged

Add Lottie integration #298

merged 15 commits into from
Sep 28, 2022

Conversation

wasabeef
Copy link
Member

@wasabeef wasabeef commented Sep 27, 2022

Base: #285 by @onlymice

What does this change?

  • Adds lottie integration.

  • Checks for lottie files by in json tags

  • Example includes on how to use it

  • Docs changed accordingly

Related

Initial Feature Request: #47
Previous PR that tried to introduce support for Lottie: #70

What's different now?

Previously HiroyukiTamura #70 implemented a Lottie integration per request #47 (comment) but as stated by britannio's #70 (comment) in the initial PR, their implementation will be better off checking for keys in the file itself, rather than only it's extension *_lottie.json as it was initially requested two years ago.

So I did.

Other issues

Why there is a lot of changes to tests

Initially Implementation of this feature required File read access, there was no issues with that if you run code as designed e.g

flutter packages pub run build_runner build

But if you try to run tests you might ended up seeing that the relative asset path that you get in isSupport is not relative to the Directory.current.path and the code in 'packages/core/lib' can't access it while running tests.

So I introduced mocked rootPath #assets_gen_integrations_test.dart#L13 for tests and now the AssetType has field for absolutePath that is constructed from the passed rootPath (config.rootPath) and the key/path.
Other integrations haven't tried to read files, cause they don't need it, so here we are, feel free to propose a better solution.

What is the value of this and can you measure success?

Measure

  • Pass tests.

  • No linting issues with generated code.

  • Example runs, plays the animation and works well.

Value

  • Others who tends to use Lottie in their projects will be happy to know that flutter_gen supports it

@wasabeef wasabeef changed the title [WIP] Add Lottie integration Add Lottie integration Sep 28, 2022
@wasabeef wasabeef added this to the v5.0.0 milestone Sep 28, 2022
@wasabeef wasabeef merged commit 9e10a6e into main Sep 28, 2022
@wasabeef wasabeef deleted the lottie-onlymice-refactor branch September 28, 2022 07:23
This was referenced Sep 28, 2022
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.

2 participants