-
-
Notifications
You must be signed in to change notification settings - Fork 876
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 more optional stylings #23
Add more optional stylings #23
Conversation
Thanks for the pull request. I'll take a look at this soon! |
I like the direction this pull request is going, however I think it could be abstracted out a bit more. Let me address each of the changes you have made individually:
|
Thanks for your fast and good feedback. I totally agree that a callback that is suggested in #2 would be very awesome. If we add this callback, I think there is no more need to set all different styles manually for elements, right? We could just provide this callback for all nodes. You can then render your custom widget and get passed along The only need to have additional padding/textstyle would be for the else case in the end when we have the final plain text node I guess. So in the parser, we would always first try to call the callback and see if that returns a custom widget and pass What would be the best mechanism to tell the library that the user did not implement a custom widget for a specific tag? Just returning null instead of a widget maybe? It could then work somehow like this in the parser: final CustomWidget customWidget = customWidgetCallback(node.localName);
if (customWidget != null) {
return customWidget(children: _parseNodeList(node.nodes));
} else {
switch (node.localName) {
.....
}
} |
I guess we will also need the |
- It is now possible to render any dom.Node with a custom renderer if necessary. - The fallback is the default rendering like before.
830fd98
to
5d3137c
Compare
Ok, I pushed my changes. This is working really well for me. Having access to the full I guess once this is merged #2 is resolved, right? |
Yeah this will fix #2. This looks good. I'll test this a little later today and then work on publishing the changes in a new version. Thanks! |
@wwwdata Sorry, it's taken me awhile to get to this. One question: Is there any reason we couldn't use a |
I used |
Sorry it has taken me so long to get to this again. I agree that using |
Hi, thanks for this awesome flutter package. It really helps us a lot to display HTML pages.
However I needed a couple more customisation options. A callback to render a custom Image widget is very useful to be able to apply stylings (rounded borders) or to add network headers and so on.
Apart from that I wanted to apply some specific text paddings and styles.
I also put the
print
call into anassert
block so that this is not constantly logging in a production environment. But for dev, it totally make sense.