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
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy