flutter_html_widget 0.0.2

  • Readme
  • Changelog
  • Installing
  • 60

flutter_html_widget #

This widget turn html string into flutter widgets like Text, RichText and Table.

This is so not a webview alternative. Think this as a read mode for simple html elements.

The widget is extracted from wiki-flutter, and is initially designed for html segments in the mobile version of wikipedia articles only, so there's gonna be many, many issues for arbitrary html segments.

demo #

import 'package:flutter_html_widget/flutter_html_widget.dart';

final html = """
<section class="homepage__key_points card">
  <h1 class="homepage__title">
    Build beautiful native apps in record time

  <div class="homepage__tagline">
    Flutter is Google’s mobile app SDK for crafting high-quality native interfaces on iOS and Android in record time. Flutter works with existing code, is used by developers and organizations around the world, and is free and open source.

new MaterialApp(
  home: new Material(
    child: new HtmlWidget(html: html, key: key)

will produce widgets like

new Wrap(
  children: <Widget>[
    new Container(
      padding: EdgeInsets.all(8.0),
      child: new RichText(
        text: new TextSpan(
          children: [
            new TextSpan(text: "Build beautiful native apps in record time")

features #

supported #

  • basic text, link, paragraph, list, image, caption, etc.

on the roadmap #

  • styles for <b> <i> <small> <section> <h12345> etc
  • inline images
  • video element
  • more options

not for now #

  • complex table

[0.0.1] #

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  flutter_html_widget: ^0.0.2

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:flutter_html_widget/flutter_html_widget.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Apr 8, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.6
  • Flutter: 1.12.13+hotfix.8

Health suggestions

Fix lib/flutter_html_widget.dart. (-0.50 points)

Analysis of lib/flutter_html_widget.dart reported 1 hint:

line 40 col 47: Use ; instead of {} for empty constructor bodies.

Maintenance issues and suggestions

Support latest dependencies. (-20 points)

The version constraint in pubspec.yaml does not support the latest published versions for 2 dependencies (html, url_launcher).

Package is getting outdated. (-64.93 points)

The package was last published 86 weeks ago.

The package description is too short. (-14 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and flutter_html_widget.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
flutter 0.0.0
html ^0.13.3 0.13.4+2 0.14.0+3
url_launcher ^3.0.1 3.0.3 5.4.2
Transitive dependencies
charcode 1.1.3
collection 1.14.11 1.14.12
csslib 0.15.0 0.16.1
meta 1.1.8
path 1.6.4
sky_engine 0.0.99
source_span 1.7.0
term_glyph 1.1.0
typed_data 1.1.6
utf 0.9.0+5
vector_math 2.0.8
Dev dependencies