Repository navigation
Draw SVG URLs with a query string, load the Rive engine on demand, ellipsis in rich Text - #7057
Merged
Merged
Conversation
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.
Deploying flet-website-v2 with
|
| 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 |
…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.
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.
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.
Three fixes for 1.1.3, all found while working on Flet Studio's web client.
SVG URLs with a query string
Imagepicked its SVG renderer withsrc.endsWith(".svg")on the whole URL, so an SVG URL with a query string or fragment, such as a cache-bustingicon.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})inutils/images.dart: for a URL, only the path counts (Uri.path), not the query or fragment. Letter case is ignored, so.SVGworks for URLs and files.getImageWidget, for files and URLs, use it.Rive engine on demand
flet_rive's extension calledRiveNative.init()inensureInitialized(), so every web app built withflet-rivedownloadedrive_native.wasm(1 MB compressed, 2.9 MB raw) and its loader at startup, even if it never showed aRivecontrol. Flet Studio does this on every first visit.ensureInitialized()is gone;RiveControlawaitsRiveNative.init()before loading its file.init()returns the same future on later calls, so several controls share one load.Ellipsis in rich text
TextwithspansbuiltText.richwithoutoverflow.Textreadsoverflowfrom its own style, and a rich text's style is on the root span, sooverflow=TextOverflow.ELLIPSISwas ignored. Text cut off bymax_lineswas 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.richnow getsoverflow: style.overflow. (SelectableText.richhas nooverflow.)Release
fletDart package is bumped to 1.1.3; the root andpackages/fletchangelogs have 1.1.3 entries.Tested
flutter test test/utils/images_test.dart: 20 passed, including newisSvgSourcecases: query, fragment, relative URL, upper case, a.svginside the query of a PNG URL, and files.flutter analyzeis clean inpackages/fletandflet_rive.FLET_WEB_PATH), cache disabled:ft.Image(src=".../icon.svg?v=1")draws the SVG; with the 1.1.2 client it is blank.Rivecontrol makes no Rive requests.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. PlainTextis unchanged.fr.Rive("https://cdn.rive.app/animations/vehicles.riv")loadsrive_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:
Enhancements:
Build:
Documentation:
Tests: