[vector_graphics] add imageBuilder property to VectorGraphic#11094
Open
suojae wants to merge 1 commit intoflutter:mainfrom
Open
[vector_graphics] add imageBuilder property to VectorGraphic#11094suojae wants to merge 1 commit intoflutter:mainfrom
suojae wants to merge 1 commit intoflutter:mainfrom
Conversation
There was a problem hiding this comment.
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.
d91da1f to
3ca0245
Compare
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
3ca0245 to
bcf23ed
Compare
domesticmouse
approved these changes
Feb 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
related with flutter/flutter#182635
Adding an
imageBuilderproperty toVectorGraphicallows 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 existingplaceholderBuilderanderrorBuilder, giving full control over all three rendering states.Changes
VectorGraphicsImageWidgettypedefimageBuilderparameter toVectorGraphicconstructors andcreateCompatVectorGraphicVectorGraphicsImageWidgetfromvector_graphics_compat.dartimageBuilderis called on success and not during placeholder stateTest plan
imageBuilder wraps the loaded vector graphic— verifies the builder is applied on successful loadimageBuilder is not called during placeholder state— verifies the builder is skipped during loading