Skip to content

[vector_graphics] add imageBuilder property to VectorGraphic#11094

Merged
gaaclarke merged 10 commits intoflutter:mainfrom
suojae:feat/add-image-builder
Apr 28, 2026
Merged

[vector_graphics] add imageBuilder property to VectorGraphic#11094
gaaclarke merged 10 commits intoflutter:mainfrom
suojae:feat/add-image-builder

Conversation

@suojae
Copy link
Copy Markdown
Contributor

@suojae suojae commented Feb 22, 2026

related with flutter/flutter#182635

Adding an imageBuilder property to VectorGraphic allows developers to wrap the successfully loaded vector graphic with decorations or interaction layers (e.g., borders, shadows, gesture detectors) only when the image is available. This completes the builder pattern alongside the existing placeholderBuilder and errorBuilder, giving full control over all three rendering states.

Changes

  • Added VectorGraphicsImageWidget typedef
  • Added optional imageBuilder parameter to VectorGraphic constructors and createCompatVectorGraphic
  • Exported VectorGraphicsImageWidget from vector_graphics_compat.dart
  • Added two tests verifying imageBuilder is called on success and not during placeholder state
  • Bumped version to 1.1.20

Test plan

  • imageBuilder wraps the loaded vector graphic — verifies the builder is applied on successful load
  • imageBuilder is not called during placeholder state — verifies the builder is skipped during loading
  • All 60 existing tests pass

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

The pull request successfully introduces the imageBuilder property to both SvgPicture and VectorGraphic widgets. This addition completes the builder pattern (placeholder, error, success) for these widgets, allowing developers to wrap the successfully loaded vector graphic with decorations or other widgets only when the image is available. The implementation is consistent across both packages, includes clear documentation, and is well-tested with new test cases in the vector_graphics package. The code follows Flutter best practices for widget builders and maintains backward compatibility.

@suojae suojae force-pushed the feat/add-image-builder branch from d91da1f to 3ca0245 Compare February 22, 2026 05:54
@suojae suojae changed the title [flutter_svg, vector_graphics] Add imageBuilder property to SvgPicture feat(vector_graphics): add imageBuilder property to VectorGraphic Feb 22, 2026
Adds an optional imageBuilder callback that wraps the loaded vector
graphic widget, enabling post-load decoration such as borders or
gesture detectors without affecting placeholder or error states.

Resolves flutter/flutter#182635
@suojae suojae force-pushed the feat/add-image-builder branch from 3ca0245 to bcf23ed Compare February 22, 2026 06:05
@stuartmorgan-g stuartmorgan-g changed the title feat(vector_graphics): add imageBuilder property to VectorGraphic [vector_graphics] add imageBuilder property to VectorGraphic Feb 24, 2026
@gbtb16
Copy link
Copy Markdown

gbtb16 commented Mar 2, 2026

LGTM!

Comment thread packages/vector_graphics/pubspec.yaml Outdated
repository: https://github.com/flutter/packages/tree/main/packages/vector_graphics
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+vector_graphics%22
version: 1.1.19
version: 1.1.20
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

new exposed type and new parameter to method as a new feature requires the MINOR number to be incremented.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks. I've bumped the version to 1.2.0 (minor). Also merge upstream.

@stuartmorgan-g stuartmorgan-g requested a review from jtmcdole March 24, 2026 18:29
@jtmcdole jtmcdole added the CICD Run CI/CD label Apr 13, 2026
@gaaclarke
Copy link
Copy Markdown
Member

@jtmcdole @domesticmouse do we want to put autosubmit on this?

@gaaclarke gaaclarke merged commit ce623f5 into flutter:main Apr 28, 2026
82 checks passed
Mairramer pushed a commit to Mairramer/flutter that referenced this pull request Apr 29, 2026
…er#185748)

flutter/packages@ba80f8f...cde5b36

2026-04-29 stuartmorgan@google.com [file_selector] Switch to Kotlin
Pigeon (flutter/packages#11479)
2026-04-29 stuartmorgan@google.com [image_picker] Switch to Kotlin
Pigeon (flutter/packages#11504)
2026-04-29 stuartmorgan@google.com [quick_actions] Switch to Kotlin
Pigeon (flutter/packages#11507)
2026-04-29 git@reb0.org [pigeon] fix: Apply correct ThrowError success
callback (flutter/packages#11585)
2026-04-29 nateshmbhat1@gmail.com [video_player_platform_interface] Add
video track selection support (flutter/packages#11474)
2026-04-29 katelovett@google.com Update git ignore for
personal/iterating on agent skills and rules (flutter/packages#11600)
2026-04-29 stuartmorgan@google.com [file_selector] Update Windows
example for deprecations (flutter/packages#11570)
2026-04-29 git@reb0.org [various] Upgrade googletest to v1.15.2
(flutter/packages#11586)
2026-04-28 engine-flutter-autoroll@skia.org Roll Flutter (stable) from
cc0734a to 02085fe (2 revisions) (flutter/packages#11598)
2026-04-28 116356835+AbdeMohlbi@users.noreply.github.com [image_picker]
Update documentation of maxDuration to reflect that it only applies to
recording (flutter/packages#11417)
2026-04-28 suojae3@gmail.com [vector_graphics] add imageBuilder property
to VectorGraphic (flutter/packages#11094)
2026-04-28 engine-flutter-autoroll@skia.org Roll Flutter from
61fca76 to 81bc3d6 (1 revision) (flutter/packages#11597)

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD p: vector_graphics triage-engine Should be looked at in engine triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants