Skip to content

include flutter widget into inline flow? #973

Answered by asmith20002
asmith20002 asked this question in Q&A
Discussion options

You must be logged in to vote

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:

return Html(
	data: data,
	tagsList: Html.tags..addAll(['morebutton']),
	customRenders:
	{
		moreButtonMatcher(): CustomRender.widget(widget: (context, buildChildren)
		{
			return Icon(icon.more);
		}),
	}
);

CustomRenderMatcher moreButtonMatcher() => (context) => context.tree.element?.localName == 'morebutton';

Note that for this to work the general flutter_html is not …

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@erickok
Comment options

@asmith20002
Comment options

@erickok
Comment options

Answer selected by asmith20002
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants