Ability to render html in widget

902 views
Skip to first unread message

Martin Spriggs

unread,
Mar 1, 2018, 12:30:50 PM3/1/18
to Flutter Dev
I'm considering switching to Flutter from Ionic/Angular but mostly deal with JSON content from a Wordpress site that gives me HTML to render. If I'm reading the docs correctly it looks like there is no way to take raw HTML content received via JSON and render that on screen? Thanks in advance!

Michael Thomsen

unread,
Mar 2, 2018, 4:30:48 AM3/2/18
to Martin Spriggs, Flutter Dev
We already support linking to a full screen html/browser via the url_launcher plugin. We unfortunately do not yet support an inline webview (see issue #730).

On Thu, Mar 1, 2018 at 6:30 PM, Martin Spriggs <martin....@gmail.com> wrote:
I'm considering switching to Flutter from Ionic/Angular but mostly deal with JSON content from a Wordpress site that gives me HTML to render. If I'm reading the docs correctly it looks like there is no way to take raw HTML content received via JSON and render that on screen? Thanks in advance!

--
You received this message because you are subscribed to the Google Groups "Flutter Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Eric Seidel

unread,
Mar 4, 2018, 7:06:38 PM3/4/18
to Michael Thomsen, Martin Spriggs, Flutter Dev
HTML is a giant spec with lots of crazy bits.  However, it should be possible to write some very basic html rendering in a Flutter widget following the patterns used in https://github.com/flutter/flutter_markdown.  I've not seen anyone do that yet however.

Even once we add inline webview support: https://github.com/flutter/flutter/issues/730 it will still be much more efficient to do simple HTML with something more akin to flutter_markdown.

I'm sure there would be a lot of demand for such a package were someone to write one. ;)

On Fri, Mar 2, 2018 at 1:30 AM 'Michael Thomsen' via Flutter Dev <flutt...@googlegroups.com> wrote:
We already support linking to a full screen html/browser via the url_launcher plugin. We unfortunately do not yet support an inline webview (see issue #730).
On Thu, Mar 1, 2018 at 6:30 PM, Martin Spriggs <martin....@gmail.com> wrote:
I'm considering switching to Flutter from Ionic/Angular but mostly deal with JSON content from a Wordpress site that gives me HTML to render. If I'm reading the docs correctly it looks like there is no way to take raw HTML content received via JSON and render that on screen? Thanks in advance!

--
You received this message because you are subscribed to the Google Groups "Flutter Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Flutter Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.

王納米

unread,
Mar 5, 2018, 4:02:58 AM3/5/18
to Eric Seidel, Michael Thomsen, Martin Spriggs, Flutter Dev
I've done something similar in wiki-flutter, since wikipedia's API also gives only html segments.

Here's a simple html parser, which consumes HTML and emits flutter widgets, via the dart `html` lib.

All you have to do is recursively travers the DOM tree and build widgets.

You've to set some custom rules, like <p>/<div> -> RichText, and consider how to handle line breaks.

The performance is bad, you get the idea though.


Reply all
Reply to author
Forward
0 new messages