-
-
Notifications
You must be signed in to change notification settings - Fork 891
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
[Proof-of-concept] Image render API #505
[Proof-of-concept] Image render API #505
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.
Overall, nice job, one small nitpick, but I would be fine accepting this proposal.
We will need to document this extremely well though, so before we merge we may want to do that....
I will complete my proposal with support for the other source/target combinations we currently supported. |
Also swallow missing sources silently and add several examples
Okay I am feature-complete now with regards to the existing implementation. As I bonus we support asset svgs. It's easy to extend support but the PR is big enough as it stands. @tneotia could you test-drive this for me? |
@erickok Test-drive has passed with flying colors. Just three things:
I get an error because the SVG element can't be rendered by
Great work, this is fantastic! Can't wait for the P.S. Go to sleep - you're working on this at like 2a.m. lol No need to be grinding that much :) |
@erickok Could we also add some unit tests for matchers before we merge? I think that this is a thing that ought to have tests just in case |
…-render-api # Conflicts: # example/lib/main.dart # lib/src/replaced_element.dart
@ryan-berger I have added unit tests for the different image source matchers (asset, base64 data and network). @tneotia good point, I have included the fix you did for #523 and made sure the size checking (for use in tables) is still needed and unfortunately it still is (so it is working as intended now). |
@erickok This is looking very good, I think I have one last question that I'm not sure if we addressed via proposals: Who is handing the error if the render function for the image throws an exception? Do we want to throw in a placeholder? Once we have that answered, I say we merge it |
Good point. For the moment I decided not to change this behaviour, so the error callback is still as-is, namely the onImageError. That's for 'expected' errors such as when an image could not be loaded. Programming errors are caught in any specific way (and we don't do that anywhere else either in our lib). |
Oh duh, forgot about that callback. I think this looks good to me then! I'll approve the merge and let you do it! |
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.
Nicely done! I'm quite excited to see this go to production!
Thanks for the help and support, @ryan-berger and @tneotia . I am going to merge. Much more coming soon! |
A proposal for an all-encompassing image render API. See #497 for a discussion and #504 for an alternative.