flutter_html_widget 0.0.2

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • 75

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
  </h1>

  <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.
  </div>
</section>
""";

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:


dependencies:
  flutter_html_widget: ^0.0.2

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

Alternatively, your editor might support pub get or flutter packages 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';
  
Version Uploaded Documentation Archive
0.0.2 Aug 14, 2018 Go to the documentation of flutter_html_widget 0.0.2 Download flutter_html_widget 0.0.2 archive
0.0.1 May 21, 2018 Go to the documentation of flutter_html_widget 0.0.1 Download flutter_html_widget 0.0.1 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
61
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
72
Overall:
Weighted score of the above. [more]
75
Learn more about scoring.

We analyzed this package on Aug 14, 2018, and provided a score, details, and suggestions below. Analysis was completed with status tool failures using:

  • Dart: 2.0.0
  • pana: 0.11.8
  • Flutter: 0.5.7

Platforms

Detected platforms: unsure

Error(s) prevent platform classification:

Fix dependencies in pubspec.yaml.

Issues and suggestions

Fix dependencies in pubspec.yaml.

Running flutter packages pub upgrade failed with the following output:

ERR: The current Dart SDK version is 2.0.0-dev.63.0.flutter-4c9689c1d2.
 
 Because flutter_html_widget requires SDK version >=2.0.0 <3.0.0, version solving failed.

Fix platform conflicts.

Error(s) prevent platform classification:

Fix dependencies in pubspec.yaml.

Running dartdoc failed.

Make sure dartdoc runs without any issues.

The description is too short.

Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

Package is pre-v1 release.

While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction of the API.

Maintain an example.

Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use flutter_html_widget.dart.

Format lib/flutter_html_widget.dart.

Run flutter format to format lib/flutter_html_widget.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0