-
-
Notifications
You must be signed in to change notification settings - Fork 887
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 support for customRender in the RichText
parser
#64
Comments
Perhaps we can solve this by merging the two parsers into one that implements a virtual DOM that is more Flutter friendly and then specify how to render that DOM as widgets. Both parsers currently create actual Flutter widgets as they walk the html tree, but if we create a middle ground, Virtual DOM, we might end up with something better than both. How to do this? Some initial ideas:
|
@jeffmikels |
@jeffmikels I really like the idea of adding an intermediary step to the parser (or as you said, a virtual DOM). As for implementing custom renderers, I think option 2 you suggested above is the best way to go. Like you said, the first option has always been there, but there are few who have used it and lots who want to expand the functionality of this plugin. Option 3 isn't a bad option, but it doesn't allow for additional, currently unsupported elements (e.g. I've been thinking a lot about the general types of elements and nodes HTML has so we can create a simplified tree, and I think I have a pretty good idea of what needs to happen. I'll be working on creating a new version of the parser based on what I've been thinking that will hopefully combine the best of both parsers. 😃 When I finish with my implementation I'll open a pull request so that we can get some discussion and hopefully fix any errors before merging to master. My hope is that the new parser can coincide with a 1.0.0 release of this plugin. 🤞 |
Please support this asap, since there is no way to set colors. I need a custom tag that can specify partial colors. |
I've created a development roadmap to show progress and planned features for version 1.0.0. |
See my fork if you need an urgent solution. I've added customRender to RichTextParser. Usage: You use customRender as it is, no difference. And you need to provide customRenderTags:
Edit: Don't rely on this. It was just an experiment. I've seen unexpected results. Clearly this is not compatible with the logic of rich text. |
Hi! |
@noobiek The first round of features is nearly there so there should be a prerelease version in the next couple weeks for people to try out! I'm currently balancing school, work, and this and several other projects, so I can't dedicate nearly as much time to this project as I want to. I'm also trying to balance bug-fixes for the current parser (the |
Hey man! Nice work. I'm currently working from your latest pull request and I'm trying to figure out how the new Custom Renderer works. Any pointers? |
After digging in a bit, I was able to figure it out but I'm still unable to get access to the Any pointers? This is really important and urgent |
@shamnex I'm still working to refine the new If you give me a bit more info about the specifics of what you're trying to achieve with |
Nice! The docs did help. But is it possible to have access to the dom node in the customRenderer?
I'm looking out for the What do you think about exposing the dom Node in the customRenderer?. I went through your code and noticed it was a private field. Thanks alot for all the hard work man. |
I also noticed there's an issue with Padding or Margin using the customRenderer. I can't seem to be able to make it take up the full width of the device. |
Yeah, exposing the dom Node is definitely possible, I didn't think that many people would need it for custom rendering, but your use case proves otherwise. As for the issue getting it to take up the full width, do you mind sharing either your code and/or some screenshots so I can debug that margin/padding issue? You can email it at sub6resources@gmail.com if you'd rather not share it here. Thank you for your feedback. It has been extremely valuable for me getting customRender ready for a production-ready release. |
Hello man, well done once again for all your work and your quick reply. I've attached a screenshot but if it's not enough, let me know if I can quickly set up a demo flutter project that reproduces the issue. Here is the first image where I just return a Here's another when I try to render a custom Widget ( in this case a WebView). It happened when I try to use the I also noticed another bug that throws an error. Whenever you try to customRender an `iframe, it throws
Thanks for all the hardwork man |
Thanks for sharing the screenshots. Its not entirely clear what the issue is from the screenshots alone, so if you could send over a demo project reproducing the issue, that would be great. Thank you! |
Hey man, thanks once again. I initially set up a minor project but after going through it one more time I figured out the problem. I noticed you added padding and/or margin to the blockquote Style so All I had to do was override them.
Thanks for your time. |
Okay, thank you. I'll be sure to make sure this is more clear when I write the documentation! Thanks! |
Thanks alot man. Have you also looked at this issue I pointed out?
This throws an error: It only happens when you try to |
Yeah, I'll look into that. I think I have a pretty good idea of what the issue is and it should be a simple fix. Were you able to figure out the issue with getting customRender to take the full width of the Html widget? |
Yup! as stated in my previous post.
I was trying to use the customRender to override |
Awesome! Thank you. |
The
RichText
version of the parser needs some sort of extension mechanism. See #37 (comment).The text was updated successfully, but these errors were encountered: