-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Add loading support to Image #33369
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add loading support to Image #33369
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we also give the total number of frames then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We won't know that ahead of time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the use case you're considering?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a media progress bar that shows where you are in a looping animated GIF (like the youtube player progress bar)
|
PTAL |
|
PTAL |
goderbauer
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The actual implementation LGTM. However, the modification of the template seems odd to me - especially since the modified template isn't even used in this PR?
goderbauer
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This adds two new builders to the `Image` class: * `frameBuilder`, which allows callers to control the widget created by an [Image]. * `loadingBuilder`, which allows callers fine-grained control over how to display loading progress of an image to the user. `FadeInImage` can be simplified by migrating to the new API. This is done in a follow-on commit. #32374
|
FYI @renefloor in case you find this relevant for cached_network_image |
This updates FadeInImage to use the new Image.frameBuilder API (added in #33369), to greatly simplify the implementation of FadeInImage. This also removes the FadeInImage.placeholderSemanticLabel property. This property was added in #28799 for the sake of completeness (the bug it fixed was the lack of any semantic label support in FadeInImage), but a placeholder is a transient visual artifact, not something that affects the underlying semantic meaning of the image.
Description
This adds two new builders to the
Imageclass:frameBuilder, which allows callers to control the widgetcreated by an [Image].
loadingBuilder, which allows callers fine-grained controlover how to display loading progress of an image to the user.
FadeInImagecan be simplified by migrating to the new API.This is done in follow-on commit.
Related Issues
#32374
Tests
I added full test coverage of the two new properties (verified in merged
lcov.info). Specifically:Checklist
///).flutter analyze --flutter-repo) does not report any problems on my PR.Breaking Change
Does your PR require Flutter developers to manually update their apps to accommodate your change?