[vector_graphics][vector_graphics_compiler] Fix text-anchor and tspan gap with adjacent <tspan>s (#11637)

## Summary

`<text x="..." text-anchor="middle"><tspan>ABCDEFG</tspan><tspan>ABCDEFG</tspan></text>` rendered noticeably differently from the equivalent single-tspan `<tspan>ABCDEFGABCDEFG</tspan>`: the two-tspan version was shifted right past the anchor *and* had a visible space between the two tspans. Two independent root causes, fixed in two separate places.

**1. `vector_graphics` — anchor applies per-chunk, not per-tspan.** The listener was independently offsetting each tspan's paragraph by `dx - paragraphWidth * xAnchorMultiplier`. Per the SVG spec, `text-anchor` applies to the entire anchored chunk (the contiguous run of glyphs whose start is established by an explicit `x`/`y`), not to each tspan in isolation. The listener now buffers per-tspan paragraphs within a chunk, flushes on the next explicit position update or on `toPicture()`, and applies the anchor offset to the chunk total. `text-anchor="start"` behavior is unchanged. A new TextPosition with `x` (or `reset=true`) starts a new chunk; bare per-tspan TextPositions emitted by the parser do not.

**2. `vector_graphics_compiler` — parser injected a spurious space between adjacent tspans.** `_appendText` had a "previous element was a tspan ⇒ prepend a space" rule that fired regardless of whether the source actually had whitespace at the boundary. So `<tspan>A</tspan><tspan>B</tspan>` parsed to `['A', ' B']` (the visible gap), even though every browser parses it to `'AB'`. Replaced with a rule that only prepends when whitespace truly exists at the boundary — either as a leading-whitespace prefix on the current text, or as an earlier whitespace-only text event we've now flagged.

Tests added on both sides:
- `vector_graphics/test/listener_test.dart`: `Text anchor middle centers the entire chunk across tspans` — drives the listener with a two-tspan middle-anchored chunk (including the parser's bare per-tspan TextPosition between them) and asserts the second tspan starts at the original x.
- `vector_graphics_compiler/test/parser_test.dart`: `adjacent tspans without whitespace are not separated by a space` and `adjacent tspans with whitespace between still get a space` — locks down both branches of the new parser rule.

Both packages bumped to `1.2.1` with CHANGELOG entries.

Fixes flutter/flutter#185927

## Before / After

| SVG | Before (buggy) | After (this PR) |
| --- | --- | --- |
| **svg1** (single tspan)<br>`<svg xmlns="http://www.w3.org/2000/svg" width="200" height="100" fill="none">`<br>&nbsp;&nbsp;`<text x="100" y="50" text-anchor="middle" fill="#FF0000">`<br>&nbsp;&nbsp;&nbsp;&nbsp;`<tspan>ABCDEFGABCDEFG</tspan>`<br>&nbsp;&nbsp;`</text>`<br>`</svg>`<br><br>**svg2** (two tspans)<br>`<svg xmlns="http://www.w3.org/2000/svg" width="200" height="100" fill="none">`<br>&nbsp;&nbsp;`<text x="100" y="50" text-anchor="middle" fill="#FF0000">`<br>&nbsp;&nbsp;&nbsp;&nbsp;`<tspan>ABCDEFG</tspan><tspan>ABCDEFG</tspan>`<br>&nbsp;&nbsp;`</text>`<br>`</svg>` | <img width="390" height="844" alt="image" src="https://github.com/user-attachments/assets/7ffbe594-d821-4b4c-b759-c5fb61a61339" /> | <img width="780" height="1688" alt="image" src="https://github.com/user-attachments/assets/076b69fb-2bfc-490a-9669-566e45f7e9a2" /> |

## Test plan

🤖 Generated with [Claude Code](https://claude.com/claude-code)
8 files changed
tree: 069dc53f48413e88bf294717dfe28d3d775468c9
  1. .agents/
  2. .ci/
  3. .claude/
  4. .gemini/
  5. .github/
  6. agent-artifacts/
  7. packages/
  8. script/
  9. third_party/
  10. .ci.yaml
  11. .clang-format
  12. .direnv
  13. .gitattributes
  14. .gitignore
  15. .metadata
  16. AGENTS.md
  17. analysis_options.yaml
  18. AUTHORS
  19. CONTRIBUTING.md
  20. customer_testing.bat
  21. customer_testing.sh
  22. LICENSE
  23. README.md
  24. SUGGESTED_REVIEWERS.md
README.md

Flutter Packages

Release Status Flutter CI Status

This repo is a companion repo to the main flutter repo. It contains the source code for Flutter's first-party packages (i.e., packages developed by the core Flutter team). Check the packages directory to see all packages.

These packages are also available on pub.

Issues

Please file any issues, bugs, or feature requests in the main flutter repo. Issues pertaining to this repository are labeled “package”.

Contributing

If you wish to contribute a new package to the Flutter ecosystem, please see the documentation for developing packages. You can store your package source code in any GitHub repository (the present repo is only intended for packages developed by the core Flutter team). Once your package is ready you can publish to the pub repository.

If you wish to contribute a change to any of the existing packages in this repo, please review our contribution guide, and send a pull request.

Packages

These are the packages hosted in this repository:

PackagePubPointsUsageIssuesPull requests
animationspub packagepub pointsdownloadsGitHub issues by-labelGitHub pull requests by-label
camerapub packagepub pointsdownloadsGitHub issues by-labelGitHub pull requests by-label
cross_filepub packagepub pointsdownloadsGitHub issues by-labelGitHub pull requests by-label
cupertino_iconspub packagepub pointsdownloadsGitHub issues by-labelGitHub pull requests by-label
cupertino_uipub packagepub pointsdownloadsGitHub issues by-labelGitHub pull requests by-label
espressopub packagepub pointsdownloadsGitHub issues by-labelGitHub pull requests by-label
extension_google_sign_in_as_googleapis_authpub packagepub pointsdownloadsGitHub issues by-labelGitHub pull requests by-label
file_selectorpub packagepub pointsdownloadsGitHub issues by-labelGitHub pull requests by-label
flutter_lintspub packagepub pointsdownloadsGitHub issues by-labelGitHub pull requests by-label
flutter_plugin_android_lifecyclepub packagepub pointsdownloadsGitHub issues by-labelGitHub pull requests by-label
flutter_svgpub packagepub pointsdownloadsGitHub issues by-labelGitHub pull requests by-label
flutter_svg_testpub packagepub pointsdownloadsGitHub issues by-labelGitHub pull requests by-label
flutter_template_imagespub packagepub pointsdownloadsGitHub issues by-labelGitHub pull requests by-label
go_routerpub packagepub pointsdownloadsGitHub issues by-labelGitHub pull requests by-label
go_router_builderpub packagepub pointsdownloadsGitHub issues by-labelGitHub pull requests by-label
google_adsensepub packagepub pointsdownloadsGitHub issues by-labelGitHub pull requests by-label
google_fontspub packagepub pointsdownloadsGitHub issues by-labelGitHub pull requests by-label
google_maps_flutterpub packagepub pointsdownloadsGitHub issues by-labelGitHub pull requests by-label
google_sign_inpub packagepub pointsdownloadsGitHub issues by-labelGitHub pull requests by-label
image_pickerpub packagepub pointsdownloadsGitHub issues by-labelGitHub pull requests by-label
interactive_media_adspub packagepub pointsdownloadsGitHub issues by-labelGitHub pull requests by-label
in_app_purchasepub packagepub pointsdownloadsGitHub issues by-labelGitHub pull requests by-label
local_authpub packagepub pointsdownloadsGitHub issues by-labelGitHub pull requests by-label
material_uipub packagepub pointsdownloadsGitHub issues by-labelGitHub pull requests by-label
metrics_centerpub packagepub pointsdownloadsGitHub issues by-labelGitHub pull requests by-label
multicast_dnspub packagepub pointsdownloadsGitHub issues by-labelGitHub pull requests by-label
path_parsingpub packagepub pointsdownloadsGitHub issues by-labelGitHub pull requests by-label
path_providerpub packagepub pointsdownloadsGitHub issues by-labelGitHub pull requests by-label
pigeonpub packagepub pointsdownloadsGitHub issues by-labelGitHub pull requests by-label
pointer_interceptorpub packagepub pointsdownloadsGitHub issues by-labelGitHub pull requests by-label
plugin_platform_interfacepub packagepub pointsdownloadsGitHub issues by-labelGitHub pull requests by-label
quick_actionspub packagepub pointsdownloadsGitHub issues by-labelGitHub pull requests by-label
google_identity_services_webpub packagepub pointsdownloadsGitHub issues by-labelGitHub pull requests by-label
mustache_templatepub packagepub pointsdownloadsGitHub issues by-labelGitHub pull requests by-label
rfwpub packagepub pointsdownloadsGitHub issues by-labelGitHub pull requests by-label
shared_preferencespub packagepub pointsdownloadsGitHub issues by-labelGitHub pull requests by-label
standard_message_codecpub packagepub pointsdownloadsGitHub issues by-labelGitHub pull requests by-label
two_dimensional_scrollablespub packagepub pointsdownloadsGitHub issues by-labelGitHub pull requests by-label
url_launcherpub packagepub pointsdownloadsGitHub issues by-labelGitHub pull requests by-label
vector_graphicspub packagepub pointsdownloadsGitHub issues by-labelGitHub pull requests by-label
vector_graphics_codecpub packagepub pointsdownloadsGitHub issues by-labelGitHub pull requests by-label
vector_graphics_compilerpub packagepub pointsdownloadsGitHub issues by-labelGitHub pull requests by-label
video_playerpub packagepub pointsdownloadsGitHub issues by-labelGitHub pull requests by-label
web_benchmarkspub packagepub pointsdownloadsGitHub issues by-labelGitHub pull requests by-label
webview_flutterpub packagepub pointsdownloadsGitHub issues by-labelGitHub pull requests by-label
xdg_directoriespub packagepub pointsdownloadsGitHub issues by-labelGitHub pull requests by-label