Skip to content

fix(flutter_svg): honor default placeholders during asynchronous SVG loading - #4

Merged
palmoni5 merged 23 commits into
mainfrom
palmoni5/flutter-svg-default-placeholder-20261109
Nov 9, 2026
Merged

palmoni5 merged 23 commits into
mainfrom
palmoni5/flutter-svg-default-placeholder-20261109

Conversation

@palmoni5

@palmoni5 palmoni5 commented Nov 9, 2026 •

Copy link
Copy Markdown
Member

Bug and user impact

SvgPicture.defaultPlaceholderBuilder is documented and publicly configurable but was never passed through when a widget omitted its own placeholder builder. This PR honors the fallback while preserving each widget's explicit builder precedence. On slow asset/network loads the default placeholder can now be used consistently. Also fixes debugFillProperties incorrectly comparing clipBehavior against BoxFit.contain instead of Clip.hardEdge.

QA

Widget regression tests exercise an unresolved network SVG, global fallback, explicit placeholder precedence and removal after successful loading. The scoped flutter_svg QA workflow performs flutter analyze, flutter test including widget/golden tests and dart format checks.
No dependency pin to a Git commit is added to Otzaria. A coordinated package version bump can follow consolidation of the fork fixes.

Independent QA and integration

Reviewed independently with added regression tests. Static analysis and the full flutter_svg suite passed locally after integration. The isolate change additionally preserves provideSvg overrides on all five built-in loader subclasses. Network keys memoize immutable hashes and use identityHashCode for injected clients.

Final exact tested commit: 4ad4cda. Cross-platform Linux/Windows CI: https://github.com/palmoni5/packages/actions/runs/42628430755 (see live run for final result).

Upstream topics: flutter#13595, flutter#13596, flutter#13597, flutter#13598, flutter#13599 and flutter#13600. Reviewer changes must be applied to both the corresponding upstream branch and codex/flutter-svg-combined.

@palmoni5
palmoni5 merged commit 2c3a2d4 into main Nov 9, 2026
3 checks passed
auto-submit Bot pushed a commit to flutter/packages that referenced this pull request Nov 25, 2026
`SvgPicture.debugFillProperties` compares `Clip` values to `BoxFit.contain`, so the default `Clip.hardEdge` is incorrectly reported as a non-default diagnostic property. Compare against the actual constructor default, `Clip.hardEdge`.

The regression test checks that the default is omitted and a non-default `Clip.none` is reported. It fails against the original implementation and passes after the fix.

Validation on Windows: `dart format lib/svg.dart test/clip_diagnostics_test.dart`, `flutter analyze` (no issues), and complete `flutter test` (72 passed, one existing skipped test). Existing platform golden differences are tolerated by the repository comparator. Final checks ran after rebasing on latest upstream/main.

Prepared with AI assistance and reviewed by the contributor.

Fixes flutter/flutter#197014.

Original fork bug report: Otzaria#4. Each issue is submitted independently.

Overlap: `git merge-tree --write-tree upstream/pr-12808 HEAD` reports a CHANGELOG-only conflict with #12808; no code overlap. Merged with main (including 2.5.0 from #13598) and bumped to 2.5.1; analyze and the complete test suite pass after the merge (94 passed, one existing skip).

## Pre-Review Checklist

**Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot 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.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant