I have to display html text as like android provides Html.fromHtml to display htmltextview does flutter provides anythings to display html text?
Asked
Active
Viewed 1.7k times
2 Answers
7
There are packages that do this
https://pub.dartlang.org/packages/webview_flutter inline browser view
https://pub.dartlang.org/packages/flutter_html renders a HTML subset in Flutter directly

Günter Zöchbauer
- 623,577
- 216
- 2,003
- 1,567
-
1flutter_html is not working in all tags include that which they provides. – Vithani Ravi Feb 12 '19 at 13:06
-
2As I said a "subset". Translating from HTML to Flutter widgets isn't trivial. – Günter Zöchbauer Feb 12 '19 at 13:06
2
Add the following to your pubspec.yaml
file:
dependencies:
flutter_html:
Currently Supported HTML Tags:
a, abbr, acronym, address, article, aside, b, bdi, bdo, big, blockquote, body, br, caption, cite, code, data, dd, del, dfn, div, dl, dt, em, figcaption, figure, footer, h1, h2, h3, h4, h5, h6, header, hr, i, img, ins, kbd, li, main, mark, nav, noscript, ol, p, pre, q, rp, rt, ruby, s, samp, section, small, span, strike, strong, sub, sup, table, tbody, td, template, tfoot, th, thead, time, tr, tt, u, ul, var
Example Usage:
Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
new Html(
data: "<b>Hai</b>,
defaultTextStyle: TextStyle(fontSize: 15),
),
],
)

Techalgoware
- 540
- 6
- 11
-
1This is great if you want to hard code your html into your app, but if you're pulling from firestore and you need different styling for different documents (or if you want to make your text selectable), this plugin does not work. – ddonche Nov 11 '20 at 19:43