include flutter widget into inline flow? #973
-
Hello, I have a long html text which breaks into multiple lines on the device. I'd like to know if it is possible to add/insert a flutter icon/widget after the last character of the html as if that widget is part of the inline flow of that html content. Here's is a sample where I want to insert an icon widget: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi vitae sapien hendrerit, malesuada elit ac, sodales dui. Nulla at tincidunt nulla. Vestibulum dignissim consequat lacus nec vestibulum. Pellentesque id enim a eros elementum viverra at quis mi. Curabitur tristique odio est, non sodales arcu maximus sed. Proin arcu risus. Icon(icon.more) Is this possible with the current version? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Alright managed to do it myself. The solution is to create a custom tag for your desired widget and then catch that custom tag with customRenders of the Html() widget. So whatever my current html data is, I'll just concatenate <morebutton></morebutton> to the end and then catch it with the custom renderer. Pretty neat:
Note that for this to work the general flutter_html is not enough. Check the external packages: Since I needed full HTML solution, I went for flutter_html_all. If you already use customImageRender of the flutter_html package, please be aware that it won't work anymore and you have to do the image render inside the customRenders. Same logic but just a little refactoring to do. |
Beta Was this translation helpful? Give feedback.
Alright managed to do it myself.
The solution is to create a custom tag for your desired widget and then catch that custom tag with customRenders of the Html() widget.
So whatever my current html data is, I'll just concatenate <morebutton></morebutton> to the end and then catch it with the custom renderer. Pretty neat:
Note that for this to work the general flutter_html is not …