Skip to content

Draw SVG URLs with a query string, load the Rive engine on demand, ellipsis in rich Text - #7057

Merged
FeodorFitsner merged 5 commits into
mainfrom
fix/svg-url-query
Nov 14, 2026
Merged

FeodorFitsner merged 5 commits into
mainfrom
fix/svg-url-query

Conversation

@FeodorFitsner

@FeodorFitsner FeodorFitsner commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Three fixes for 1.1.3, all found while working on Flet Studio's web client.

SVG URLs with a query string

Image picked its SVG renderer with src.endsWith(".svg") on the whole URL, so an SVG URL with a query string or fragment, such as a cache-busting icon.svg?v=2, was decoded as a bitmap and drew nothing. Flet Studio ran into this when it versioned its image previews (?v=<etag>) so an edited icon would refresh.

  • isSvgSource(src, {isUrl}) in utils/images.dart: for a URL, only the path counts (Uri.path), not the query or fragment. Letter case is ignored, so .SVG works for URLs and files.
  • The two SVG checks in getImageWidget, for files and URLs, use it.

Rive engine on demand

flet_rive's extension called RiveNative.init() in ensureInitialized(), so every web app built with flet-rive downloaded rive_native.wasm (1 MB compressed, 2.9 MB raw) and its loader at startup, even if it never showed a Rive control. Flet Studio does this on every first visit.

  • ensureInitialized() is gone; RiveControl awaits RiveNative.init() before loading its file. init() returns the same future on later calls, so several controls share one load.
  • If the engine fails to load, the control shows "Rive failed to load: …" instead of failing later.
  • Initialization used to be fire-and-forget at startup; the control now waits for it before decoding the file.

Ellipsis in rich text

Text with spans built Text.rich without overflow. Text reads overflow from its own style, and a rich text's style is on the root span, so overflow=TextOverflow.ELLIPSIS was ignored. Text cut off by max_lines was clipped at a word with no "…". Flet Studio's agent chat ran into this with its one-line "Edited 5 files: footer.py, header.py, …" rows, where the names are links.

  • Text.rich now gets overflow: style.overflow. (SelectableText.rich has no overflow.)

Release

  • The flet Dart package is bumped to 1.1.3; the root and packages/flet changelogs have 1.1.3 entries.

Tested

  • flutter test test/utils/images_test.dart: 20 passed, including new isSvgSource cases: query, fragment, relative URL, upper case, a .svg inside the query of a PNG URL, and files. flutter analyze is clean in packages/flet and flet_rive.
  • In headless Chrome with a web client built from this branch (FLET_WEB_PATH), cache disabled:
    • ft.Image(src=".../icon.svg?v=1") draws the SVG; with the 1.1.2 client it is blank.
    • An app with no Rive control makes no Rive requests.
    • A 300 px Text(spans=[...], max_lines=1, overflow=ELLIPSIS) ends in "settings_p…"; with the 1.1.2 client it is clipped after "header.py," with no ellipsis. Plain Text is unchanged.
    • An app with fr.Rive("https://cdn.rive.app/animations/vehicles.riv") loads rive_native.js, rive_native.wasm, then the .riv, and draws the animation, with no console errors.

Summary by Sourcery

Improve web image rendering and rich-text truncation while deferring Rive engine loading until it is needed.

Bug Fixes:

  • Fix SVG images with URL query strings or fragments being rendered as blank images.
  • Preserve ellipsis overflow behavior for rich text when content exceeds its maximum lines.

Enhancements:

  • Load the Rive engine only when the first Rive control is used, reducing startup downloads for apps that do not display Rive content.

Build:

  • Bump the flet Dart package version to 1.1.3.

Documentation:

  • Add 1.1.3 release notes describing the SVG, rich text, and on-demand Rive improvements.

Tests:

  • Add coverage for SVG source detection across URL queries, fragments, casing, and file paths.

Image picked SvgPicture by `src.endsWith(".svg")` on the whole URL, so a
cache-busting `icon.svg?v=2` (or a `#fragment`) was decoded as a bitmap
and drawn blank. `isSvgSource()` checks only the URL's path, in any
letter case; files are matched case-insensitively too.

Bump the flet Dart package to 1.1.3.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

Deploying flet-website-v2 with  Cloudflare Pages  Cloudflare Pages

Latest commit: ba03dc6
Status: ✅  Deploy successful!
Preview URL: https://dea21189.flet-website-v2.pages.dev
Branch Preview URL: https://fix-svg-url-query.flet-website-v2.pages.dev

View logs

…tartup

RiveNative.init() ran in the extension's ensureInitialized(), so every web
app built with flet-rive downloaded rive_native.wasm (1 MB) and its loader
on startup, even when it never showed a Rive control. The control now
awaits init() before loading its file; later calls share the same future.
@FeodorFitsner FeodorFitsner changed the title Draw SVG images whose URL has a query string Draw SVG URLs with a query string; load the Rive engine on demand Nov 7, 2026
Text with spans built Text.rich without its overflow. Text reads overflow
from its own style, and a rich text's style is on the root span, so
TextOverflow.ELLIPSIS was ignored and the text was clipped at a word.
@FeodorFitsner FeodorFitsner changed the title Draw SVG URLs with a query string; load the Rive engine on demand Draw SVG URLs with a query string, load the Rive engine on demand, ellipsis in rich Text Nov 9, 2026
@FeodorFitsner
FeodorFitsner merged commit 3ef942c into main Nov 14, 2026
2 of 93 checks passed
@FeodorFitsner
FeodorFitsner deleted the fix/svg-url-query branch November 14, 2026 02:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant