flutter_widget_from_html 0.1.0

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • new82

Flutter Widget from HTML

A Flutter plugin for building Flutter-widget tree from html.

This package extends the flutter_widget_from_html_core package with extra functionalities by using external depedencies like cached_network_image or url_launcher. It should be good enough as a quick starting point but you can always use the core directly if you dislike the dependencies.

Usage

To use this plugin, add flutter_widget_from_html as a dependency in your pubspec.yaml file.

See the Example app for inspiration.

Example

Note: HtmlWidget.config is optional, see dartdoc for all available configuration keys and their default values.

class HelloWorldScreen extends StatelessWidget {
  @override
  Widget build(BuildContext context) => Scaffold(
      appBar: AppBar(
        title: Text('HelloWorldScreen'),
      ),
      body: ListView(
        children: <Widget>[
          HtmlWidget("""<h1>Heading 1</h1>
<h2>Heading 2</h2>
<h3>Heading 3</h3>
<h4>Heading 4</h4>
<h5>Heading 5</h5>
<h6>Heading 6</h6>
<p>A paragraph with <strong>strong</strong> <em>emphasized</em> text.</p>
<p>And of course, cat image: <img src="https://media.giphy.com/media/6VoDJzfRjJNbG/giphy-downsized.gif" /></p>
<div style="text-align: center">Source: <a href="https://gph.is/QFgPA0">https://gph.is/QFgPA0</a></div>
"""),
        ],
      ));
}

Features

This package has all the features of flutter_widget_from_html_core and some nice extras:

  • Renders A tag with theme accent color, launch url via url_launcher
  • Renders IMG tag with CachedNetworkImage and padding (Config.imagePadding)
  • Renders lists (OL/UL) with marker and padding (Config.listBullet, Config.listPaddingLeft)
  • Renders texts with padding (Config.textPadding)
  • Supports relative url (A href, IMG src)

0.0.1

  • First release

example/main.dart

import 'package:flutter/material.dart';
import 'package:flutter_widget_from_html/flutter_widget_from_html.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Widget from HTML',
      home: Scaffold(
        appBar: AppBar(
          title: Text('Flutter Widget from HTML'),
        ),
        body: Center(
          child: HtmlWidget('Hello World!'),
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  flutter_widget_from_html: ^0.1.0

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter packages get

Alternatively, your editor might support 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_widget_from_html/flutter_widget_from_html.dart';
  
Version Uploaded Documentation Archive
0.1.0 Oct 19, 2018 Go to the documentation of flutter_widget_from_html 0.1.0 Download flutter_widget_from_html 0.1.0 archive
0.0.2 Oct 19, 2018 Go to the documentation of flutter_widget_from_html 0.0.2 Download flutter_widget_from_html 0.0.2 archive
0.0.1 Oct 18, 2018 Go to the documentation of flutter_widget_from_html 0.0.1 Download flutter_widget_from_html 0.0.1 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
63
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
82
Learn more about scoring.

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

  • Dart: 2.0.0
  • pana: 0.12.6
  • Flutter: 0.11.3

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.68.0 <3.0.0
cached_network_image ^0.4.2 0.4.2 0.5.0+1
flutter 0.0.0
flutter_widget_from_html_core ^0.1.0 0.1.0
url_launcher ^4.0.0 4.0.1
Transitive dependencies
args 1.5.1
async 2.0.8
charcode 1.1.2
collection 1.14.11
convert 2.0.2
crypto 2.0.6
csslib 0.14.6
flutter_cache_manager 0.1.2 0.2.0+1
http 0.11.3+17 0.12.0
http_parser 3.1.3
logging 0.11.3+2
meta 1.1.6
path 1.6.2
path_provider 0.4.1
shared_preferences 0.4.3
sky_engine 0.0.99
source_span 1.4.1
string_scanner 1.0.4
synchronized 1.5.3
typed_data 1.1.6
utf 0.9.0+5
uuid 1.0.3
vector_math 2.0.8
Dev dependencies
flutter_test
html ^0.13.3 0.13.3+3