Skip to content

[vector_graphics_compiler] Add example for pub.dev Example tab#11314

Open
sheershtehri7 wants to merge 1 commit intoflutter:mainfrom
sheershtehri7:add-vgc-example
Open

[vector_graphics_compiler] Add example for pub.dev Example tab#11314
sheershtehri7 wants to merge 1 commit intoflutter:mainfrom
sheershtehri7:add-vgc-example

Conversation

@sheershtehri7
Copy link

@sheershtehri7 sheershtehri7 commented Mar 21, 2026

Creates a standalone example app in vector_graphics_compiler/example/ demonstrating the build-time SVG asset transformer with AssetBytesLoader. Adds example/example.md for the pub.dev Example tab and updates the package README with a link to the new example.

Fixes flutter/flutter#183947

Pre-Review Checklist

Footnotes

  1. Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.

@sheershtehri7 sheershtehri7 requested a review from jtmcdole as a code owner March 21, 2026 04:27
@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging.

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group.

@github-actions github-actions bot added p: vector_graphics triage-engine Should be looked at in engine triage labels Mar 21, 2026
Copy link

@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

This pull request adds an example for the vector_graphics_compiler package. It introduces an example.md file and updates the main README.md to point to a new, more comprehensive example. The example application in the vector_graphics package is extended to demonstrate both runtime SVG loading via NetworkSvgLoader and build-time SVG compilation using an asset transformer with AssetBytesLoader. A new SVG asset is added for this purpose, and the pubspec.yaml is updated accordingly. The review includes a suggestion to replace hardcoded spacing values with constants to improve maintainability.

@sheershtehri7
Copy link
Author

This PR adds only documentation (example/example.md, README.md update) and example app code (extending the existing vector_graphics example). No production library logic is changed, so no new tests are needed and no version bump or CHANGELOG update is required. The CHANGELOG checklist item is intentionally left unchecked for this reason.

@stuartmorgan-g
Copy link
Collaborator

Thanks for the contribution!

No production library logic is changed, so no new tests are needed and no version bump or CHANGELOG update is required. The CHANGELOG checklist item is intentionally left unchecked for this reason.

The CHANGELOG checklist item has two options; doing one of them is required, which is why it's on the checklist. If you believe that this PR falls under the documented exceptions, then you should list the specific documented exception(s) that this falls under and check the item.

SizedBox(
width: 150,
height: 150,
child: VectorGraphic(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there a reason we can't add a widget test to the example that verifies that this widget is loaded and has the correct size, so that we have an automated test that the example is doing what we expect?

Copy link
Author

Choose a reason for hiding this comment

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

the restructured standalone example app includes test/widget_test.dart which verifies:
The app bar title 'Build-time SVG Transformer' is present
The SizedBox wrapping the VectorGraphic has the correct 200×200 dimensions
Happy to extend the test coverage further if needed.

@sheershtehri7
Copy link
Author

Thanks for the contribution!

No production library logic is changed, so no new tests are needed and no version bump or CHANGELOG update is required. The CHANGELOG checklist item is intentionally left unchecked for this reason.

The CHANGELOG checklist item has two options; doing one of them is required, which is why it's on the checklist. If you believe that this PR falls under the documented exceptions, then you should list the specific documented exception(s) that this falls under and check the item.

This PR falls under the documented exception for "PRs that only affect unpublished parts of example apps" from the Version and CHANGELOG section of the contributing guide.
The only change to the published package is the README.md update. However, I acknowledge the guide also notes:
Even version exempt changes should often include a CHANGELOG entry, since some changes (e.g., certain updates to examples) that do not need to be published may still be of interest to clients.
Given that the README.md now links to a new example app, I'm happy to add a NEXT CHANGELOG entry to vector_graphics_compiler if you'd like — something like:
NEXT - Adds example app demonstrating build-time SVG asset transformation.

Please let me know your preference and I'll update accordingly.

@stuartmorgan-g
Copy link
Collaborator

This PR falls under the documented exception for "PRs that only affect unpublished parts of example apps"

example/lib/main.dart is published on pub.dev, so is not an unpublished part of the example app.

The only change to the published package is the README.md update.

The package README isn't part of the example app at all, so cannot fall under an exemption that only applies to the example app.

Please see also https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#faq

Creates a standalone example app in vector_graphics_compiler/example/
demonstrating the build-time SVG asset transformer with AssetBytesLoader.
Adds example.md for the pub.dev Example tab. Updates the package README
with a link to the new example.

Fixes flutter/flutter#183947
@sheershtehri7
Copy link
Author

This PR falls under the documented exception for "PRs that only affect unpublished parts of example apps"

example/lib/main.dart is published on pub.dev, so is not an unpublished part of the example app.

The only change to the published package is the README.md update.

The package README isn't part of the example app at all, so cannot fall under an exemption that only applies to the example app.

Please see also https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#faq

You're right on both counts, I apologize for the incorrect exception claim. I've added a patch version bump (1.2.0 → 1.2.1) and CHANGELOG entry covering the README update and example app addition.

@stuartmorgan-g
Copy link
Collaborator

You're right on both counts

Please do not paste sycophantic AI responses into comments. Telling reviewers that they understand their own policies serves no constructive purpose.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

[vector_graphics] Add an example to vector_graphics_compiler

2 participants