-
-
Notifications
You must be signed in to change notification settings - Fork 893
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
support needed for vertical-align property with images #556
Comments
If you'd like you can submit a PR and @erickok will review it, since you already have created a solution. It definitely seems like a great feature! :) |
To support vertical-align styling beyond just the use case here, maybe we could use transform? I'd have to read up on what this css property does exactly on the web. |
Oh yeah that's an issue then. Okay we have to take a good look. I saw your commits and they look promising, but I hope to find something beyond just support for this css property for just inline svg images. |
I understand that it seems like a corner use-case. But, we can look at it like a general support for vertical-align inline style. It will work on all kinds of images (SVG, PNG) and also can be helpful when mixing fonts. Some people mix symbols with text on the same line, and they expect it to be aligned. And, some people just want to shift the text alignment. If image alignment is implemented, then whatever people can convert every complex html attribute into SVG and use it with this library. |
@ngaurav I tried to replicate your setup but its not working for me, the image still renders in the middle of the text. Any ideas? |
@tneotia , For me it is working with BaselineBox class Refer to https://gitlab.com/nishant.gaurav/flutter_html/-/tree/dev.
|
@ngaurav I tried your branch (I had to update the dependencies bc of conflicts) and the SVG does not show up, is there code I am missing? |
@tneotia Actually the SVG is showing up. I had used a color filter which was making SVGs white for dark backgrounds. I have updated the branch now. It should be visible. |
Yes it works now and I identified why my implementation wasn't working. Something interesting: Using Only when using Now this brings up a dilemma - I can try and use Edit: Also intrinsics aren't available for |
@tneotia |
Another idea could be to try getting the baseline from child and then shifting it in BaselineBox Class:
EDIT: This allow _baseline to just have the vertical-align, while in previous case _baseline will be sum of height and vertical-align. |
Closing as duplicate of #481. Follow that issue for updates. |
I am storing text with some latex code for math part. Using python markdown extensions that text can be converted into html, which is mostly text but the latex is rendered as SVG in
tag. To match the baseline of image with the text, there is a vertical-align attribute. Flutter_html currently ignores inline vertical-align attributes for img tag. To suit my requirements, I have created a hacky fork of flutter_html = which uses a class called BaselineBox to define a baseline for its child (SvgContentElement class). If this sounds like a worthy feature for flutter_html, then please implement it. Here is a sample html node, which can be used as a test case.
<p>If <img class="latex-inline math" style="vertical-align:-0.353876pt" alt="" id="4b09cb9bb985eb9" src="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0nMS4wJyBlbmNvZGluZz0nVVRGLTgnPz48IS0tIFRoaXMgZmlsZSB3YXMgZ2VuZXJhdGVkIGJ5IGR2aXN2Z20gMi44LjEgLS0+PHN2ZyB2ZXJzaW9uPScxLjEnIHhtbG5zPSdodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZycgeG1sbnM6eGxpbms9J2h0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsnIHdpZHRoPScyMC4wODkxNTVwdCcgaGVpZ2h0PScxMS4yOTIwODNwdCcgdmlld0JveD0nMCAtMTAuOTM5NTMgMjAuMDg5MTU1IDExLjI5MjA4Myc+PGRlZnM+PHBhdGggaWQ9J2cyLTQ2JyBkPSdNLjY2MjIyOS0uNTYyMThDLjQ5NTQ4MS0uNTYyMTggLjM1NzMxOC0uNDI4NzgxIC4zNTczMTgtLjI1NzI2OVMuNDk1NDgxIC4wNDI4NzggLjY2MjIyOSAuMDQyODc4Uy45NjIzNzYtLjA5MDUyIC45NjIzNzYtLjI1NzI2OUMuOTYyMzc2LS40Mjg3ODEgLjgyODk3Ny0uNTYyMTggLjY2MjIyOS0uNTYyMThaJy8+PHBhdGggaWQ9J2cyLTU1JyBkPSdNLjMzODI2MS0zLjE5NjgwM1YtMi40MDExNzVILjU2MjE4TC42Mzg0MDgtMi44MzQ3MjFIMi4xMDU3OTNMLjU1MjY1MSAuMTc2Mjc3SC45NDgwODNWLjA3MTQ2NEwyLjUyOTgxLTMuMDA2MjMzVi0zLjE5NjgwM0guMzM4MjYxWicvPjxwYXRoIGlkPSdnMS00OScgZD0nTTMuMTY4MjE3LTEuNjQ4NDI2QzIuNzU4NDkzLTIuMTE1MzIxIDIuMjgyMDY5LTIuNTQ0MTAyIDEuNjY3NDgzLTIuNTQ0MTAyQy45MDk5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4LTEuNzkxMzUzIDEuMjQzNDY2LTIuMTE1MzIxIDEuNjY3NDgzLTIuMTE1MzIxQzIuMTg2Nzg1LTIuMTE1MzIxIDIuNTY3OTI0LTEuNzEwMzYxIDIuOTA2MTg0LTEuMzEwMTY1WicvPjx1c2UgaWQ9J2c2LTQ2JyB4bGluazpocmVmPScjZzItNDYnLz48dXNlIGlkPSdnOS01NScgeGxpbms6aHJlZj0nI2cyLTU1Jy8+PHVzZSBpZD0nZzEyLTU1JyB4bGluazpocmVmPScjZzItNTUnIHRyYW5zZm9ybT0nc2NhbGUoMS40KScvPjx1c2UgaWQ9J2cxNS01NScgeGxpbms6aHJlZj0nI2cyLTU1JyB0cmFuc2Zvcm09J3NjYWxlKDIpJy8+PC9kZWZzPjxnIGlkPSdwYWdlMSc+PHVzZSB4PScwJyB5PScwJyB4bGluazpocmVmPScjZzE1LTU1Jy8+PHVzZSB4PSc1LjMxNzY5NicgeT0nLTMuODE2MTAzJyB4bGluazpocmVmPScjZzEyLTU1Jy8+PHVzZSB4PSc5LjA0MDA4MycgeT0nLTYuNDg3Mzc2JyB4bGluazpocmVmPScjZzktNTUnLz48dXNlIHg9JzExLjY5ODkzJyB5PSctOC4zOTU0MjgnIHhsaW5rOmhyZWY9JyNnNi00NicvPjx1c2UgeD0nMTMuMDI4MzU0JyB5PSctOC4zOTU0MjgnIHhsaW5rOmhyZWY9JyNnNi00NicvPjx1c2UgeD0nMTQuMzU3Nzc4JyB5PSctOC4zOTU0MjgnIHhsaW5rOmhyZWY9JyNnMS00OScvPjwvZz48L3N2Zz4="> is divided by 5 what will be the remainder?</p>
The text was updated successfully, but these errors were encountered: