[vector_graphics] Respect BoxFit parameter with viewbox#11012
[vector_graphics] Respect BoxFit parameter with viewbox#11012auto-submit[bot] merged 8 commits intoflutter:mainfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request fixes an issue where BoxFit was not being respected for vector graphics with a viewBox. The change refactors the sizing logic in _VectorGraphicWidgetState to correctly use FittedBox. The PR also renames an internal variable for clarity and adds extensive new tests, including golden file tests, to verify the fix. The changes are logical and well-tested. I've included a few minor suggestions to align with Dart's style guide.
81bbbe6 to
baa096a
Compare
|
It seems, that the goldens fail, although they succeed locally on my Mac. As I am not sure, if we should keep them anyways, I wait until generating on Linux (as I need to set it up then). |
| }); | ||
| }); | ||
|
|
||
| // TODO(gustl22): can be removed if redundant |
There was a problem hiding this comment.
Can remove goldens (if too costly for CI), but maybe is a good thing to have them in place (more intuitive to see, what's going on).
|
@jtmcdole you are assigned as reviewer. Is it feasable to triage or delegate reviewing this PR? Thanks for your time. |
I must have been auto-assigend for owners reasons. When I see failing tests, I usually assume the PR is still in flux. Any chance you can address the failures first? |
|
@jtmcdole thank you for getting back. As I wrote here, it would be good to know, if goldens are actually desired in this case: |
# Conflicts: # packages/vector_graphics/CHANGELOG.md
|
If you are having a hard time creating a golden that passes on macos and linux, can't you just add 2 different goldens, one for each platform? |
|
@gaaclarke thank you for your proposal, I will probably remove my golden tests, as they still fail on CI even if rendered on Linux locally. I would have liked to get a comment on what is your preferred testing strategy:
|
|
I removed the redundant golden tests for now. If not sufficient, we can think about the approach how to add them. All tests pass now. |
gaaclarke
left a comment
There was a problem hiding this comment.
Code looks good and I ran the it locally with the reproduction code to verify it does fix the problem. Thanks!
flutter/packages@ee460d6...ecace66 2026-03-11 srawlins@google.com [pigeon] Produce a helpful error for bad method return type (flutter/packages#11204) 2026-03-11 srawlins@google.com [pigeon] Use hasLength and isEmpty in tests for better failure messages (flutter/packages#11205) 2026-03-11 dacoharkes@google.com [rfw] Opt out of icon tree shaking (flutter/packages#11216) 2026-03-11 srawlins@google.com [pigeon] Tidy imports and "ignore" comments (flutter/packages#11149) 2026-03-11 49699333+dependabot[bot]@users.noreply.github.com [dependabot]: Bump org.jetbrains.kotlin:kotlin-bom from 2.2.21 to 2.3.10 in /packages/pigeon/platform_tests/test_plugin/android (flutter/packages#10984) 2026-03-11 srawlins@google.com [pigeon] Improve casting and nullability-handling in generated code (flutter/packages#11163) 2026-03-10 engine-flutter-autoroll@skia.org Roll Flutter from 2ec61af to 195ae7b (36 revisions) (flutter/packages#11222) 2026-03-10 git@reb0.org [vector_graphics] Respect BoxFit parameter with viewbox (flutter/packages#11012) 2026-03-10 stuartmorgan@google.com Add AI contribution guidelines to PR checklist (flutter/packages#11195) 2026-03-10 zezohassam@gmail.com [video_player] Optimize caption retrieval with binary search in VideoPlayerController (flutter/packages#8347) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC flutter-ecosystem@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Closes flutter/flutter#158496
Pre-Review Checklist
[shared_preferences]pubspec.yamlwith an appropriate new version according to the pub versioning philosophy, or I have commented below to indicate which version change exemption this PR falls under1.CHANGELOG.mdto add a description of the change, following repository CHANGELOG style, or I have commented below to indicate which CHANGELOG exemption this PR falls under1.///).If you need help, consider asking for advice on the #hackers-new channel on Discord.
Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the
gemini-code-assistbot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.Footnotes
Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. ↩ ↩2 ↩3