Skip to content

Add new option parse_animation to parse metadata for animated images #676

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

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

huandu
Copy link

@huandu huandu commented Mar 24, 2025

What does this change?

Fixes #675

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open a GitHub issue as a bug/feature request before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
    • Ensure the tests (melos run test)
    • Ensure the analyzer and formatter pass (melos run format to automatically apply formatting)
  • Appropriate docs were updated (if necessary)

Copy link

codecov bot commented Mar 24, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.62%. Comparing base (fd63623) to head (8c3f16c).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #676      +/-   ##
==========================================
+ Coverage   97.55%   97.62%   +0.06%     
==========================================
  Files          21       21              
  Lines         819      843      +24     
==========================================
+ Hits          799      823      +24     
  Misses         20       20              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@huandu huandu force-pushed the feature/parse-animation branch from 8c3f16c to c126a82 Compare April 7, 2025 03:10
@@ -116,12 +126,20 @@ ${isPackage ? "\n static const String package = '$packageName';" : ''}

@override
String classInstantiate(AssetType asset) {
final info = parseMetadata ? _getMetadata(asset) : null;
final info = parseMetadata || parseAnimation ? _getMetadata(asset) : null;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if the user puts parse_metadata: false and parse_animation: true at the same time? We used to imply that parse_metadata is false, but it seems a bit overwhelming, and we could throw an exception here rather than keep implying these behaviors.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

parse_animation: true implies parse_metadata: false. Parsing animation requires image meta data. We can choose to drop meta data in this case. However, as the meta data has been parsed, I feel it's ok to write the parsed meta data in generated files.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we go further and let parse_metadata: true include generating animations without using this extra option?

@AlexV525
Copy link
Member

Also the workflow is complaining about untracked changes

@huandu huandu force-pushed the feature/parse-animation branch from 1382b0f to 010cae8 Compare April 16, 2025 03:41
@huandu
Copy link
Author

huandu commented Apr 16, 2025

All issues and comments should have been addressed or replied. Please take a look at these changes. Thanks.

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.

[FR]: Parse meta data for images with animation
2 participants