Skip to content

Use .vec SVG class for vector_graphics_compiler transformed assets #685

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

Merged
merged 4 commits into from
Jul 16, 2025

Conversation

Albert221
Copy link
Contributor

@Albert221 Albert221 commented May 10, 2025

What does this change?

In the SVG integration, assets that have a vector_graphics_compiler asset transformer will use SvgGenImage.vec constructor to use correct bytes loader.

Fixes #684 🎯

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)

@Albert221 Albert221 force-pushed the feat/transformers-support branch 2 times, most recently from 7cb6b47 to 4471a49 Compare May 10, 2025 13:15
@Albert221 Albert221 marked this pull request as ready for review May 10, 2025 13:15
@Albert221
Copy link
Contributor Author

@AlexV525 should be ready now :)

@Albert221 Albert221 force-pushed the feat/transformers-support branch from 4471a49 to 3fb54fd Compare May 10, 2025 13:32
@AlexV525
Copy link
Member

Looks good overall. Could you solve the CI failures?

@SAGARSURI
Copy link

Looking forward to this change. 🎉

@Azzeccagarbugli
Copy link

This would be very helpful indeed ✨

@Albert221
Copy link
Contributor Author

Looks like the fail was due to dart format formatting the test_resources/actual_data files. Should FlutterGen format its output files? I'd say so, or disable formatting in the whole file with // dart format off.

Anyway, should be fixed now I hope

Copy link

codecov bot commented Jul 15, 2025

Codecov Report

Attention: Patch coverage is 89.65517% with 3 lines in your changes missing coverage. Please review.

Project coverage is 96.62%. Comparing base (3e0108f) to head (726d3af).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
packages/core/lib/settings/asset_type.dart 50.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #685      +/-   ##
==========================================
- Coverage   96.90%   96.62%   -0.29%     
==========================================
  Files          22       22              
  Lines         840      858      +18     
==========================================
+ Hits          814      829      +15     
- Misses         26       29       +3     

☔ 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.

@Albert221
Copy link
Contributor Author

I've increased the volume of toString() which seems to not be covered. I don't think that's a failed check to me, but please say if I should cover it anyway

@AlexV525
Copy link
Member

Should FlutterGen format its output files? I'd say so, or disable formatting in the whole file with // dart format off.

Formatting has some regression and I'm investigating.

Copy link
Member

@AlexV525 AlexV525 left a comment

Choose a reason for hiding this comment

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

Thanks for the feature

@AlexV525 AlexV525 merged commit 675eb2e into FlutterGen:main Jul 16, 2025
4 of 5 checks passed
@Albert221 Albert221 deleted the feat/transformers-support branch July 16, 2025 11:15
AlexV525 added a commit that referenced this pull request Jul 17, 2025
## What does this change?

Generated files are being formatted based on confusing conditions. The
PR refactored how we construct the Dart formatter in a more elegant
manner.

1. The formatter will try to find a valid Dart SDK constraint from
`pubspec.yaml` / `pubspec.lock`. Otherwise, it will fall back to using
the current Dart SDK version as the constraint. The behavior is like:
1. When the user is using Dart SDK 3.8.0, `pubspec.yaml` has `^3.4.0`,
and `pubspec.lock` resolves `^3.7.0`, the formatter will format like
3.4.0.
2. When the runner is being used for testing purposes, which the
specified pubspec file does not contain `environment - sdk` (and likely
does not have a `pubspec.lock`), the formatter will format based on the
current Dart SDK version.
2. The formatter will try to find a valid page width from
`analysis_options.yaml - formatter - page_width` / `pubspec.yaml -
flutter_gen - line_length`, then prepend the format width header to make
all format tools respect the config.

- Fixes
#685 (comment)
- Fixes
#659 (comment)
- Fixes #620

## Type of change

- [x] New feature (non-breaking change which adds functionality)
@AlexV525 AlexV525 mentioned this pull request Jul 17, 2025
AlexV525 added a commit that referenced this pull request Jul 17, 2025
## 5.11.0

**Feature**

- [#576](#576) Add support
for deferred components. by [@ianmaciel](https://github.com/ianmaciel)
- [#676](#676) Add new
option `parse_animation` to parse metadata for animated images. by
[@huandu](https://github.com/huandu)
- [#680](#680) Add svg
`ColorMapper` to svg loader. by [@AlexV525](https://github.com/AlexV525)
- [#685](#685) Use `.vec`
SVG class for `vector_graphics_compiler` transformed assets. by
[@Albert221](https://github.com/Albert221)
- [#697](#697) Refactor
how generated files are being formatted. by
[@AlexV525](https://github.com/AlexV525)

**Development**

- [#681](#682) Bump
`dart_style` v3 which also requires Dart 3.4. by
[@AlexV525](https://github.com/AlexV525)
- [#682](#682) Add Facts
generate utils. by [@AlexV525](https://github.com/AlexV525)
- [#694](#694) Use
fine-grained logger instead of `stdout.writeln`. by
[@AlexV525](https://github.com/AlexV525)
- [#698](#698) Improve
workflow with automatic formatting. by
[@AlexV525](https://github.com/AlexV525)
- [#699](#699) Allow
`build 3.0.0`. by [@davidmorgan](https://github.com/davidmorgan)
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]: Support flutter_svg asset transformed files (vector_graphics_compiler)
4 participants