Vithani Ravi
Vithani Ravi

Reputation: 1981

How to display html text in flutter?

I have to display html text as like android provides Html.fromHtml to display htmltextview does flutter provides anythings to display html text?

Upvotes: 7

Views: 21053

Answers (3)

Karthikeyan Veeramani
Karthikeyan Veeramani

Reputation: 121

  1. That converts HTML code into well-structured Flutter widgets.

flutter pub add flutter_widget_from_html_core

This will add a line like this to your package's pubspec.yaml (and run an implicit flutter pub get):🔼

  1. Refer this link 🔽

flutter_widget_from_html_core

Features🔽

read this

  1. Example

package example

  1. normally integrate

import 'package:flutter_widget_from_html_core/flutter_widget_from_html_core.dart';

Scaffold(
        appBar: AppBar(
          title: Text('Appbar'),
        ),
        body: Center(
          child: HtmlWidget('Hello World!'),
        ),
      );

Upvotes: 1

Techalgoware
Techalgoware

Reputation: 620

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),
       ),
     ],
)

Upvotes: 3

G&#252;nter Z&#246;chbauer
G&#252;nter Z&#246;chbauer

Reputation: 657937

There are packages that do this

Upvotes: 7

Related Questions