flutter_html_view 0.5.8

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

flutter_html_view

Flutter Plugin to render html as a Widget,

Flutter has no default support to render html so this package helps you to render your html to native widgets

  • Video tag support added
  • Links are clickable now

Supported Tags

  • p
  • em
  • b
  • img
  • video
  • h1, h2, h3, h4, h5, h6

Note

  • This plugin converts some of the html tags to flutter widgets
  • This plugin does't support rendering full html code (there is no built in support for web rendering in flutter)

How to Use


dependencies:
  flutter_html_view: "^0.5.8"
  

import 'package:flutter_html_view/flutter_html_view.dart';

String html = '<body>Hello world! <a href="www.html5rocks.com">HTML5 rocks!';

new HtmlText(data: html);

iOS

Warning: The video player is not functional on iOS simulators. An iOS device must be used during development/testing.

Add the following entry to your Info.plist file, located in <project root>/ios/Runner/Info.plist:

<key>NSAppTransportSecurity</key>
<dict>
  <key>NSAllowsArbitraryLoads</key>
  <true/>
</dict>

This entry allows your app to access video files by URL.

Android

Ensure the following permission is present in your Android Manifest file, located in `<project root>/android/app/src/main/AndroidManifest.xml:

<uses-permission android:name="android.permission.INTERNET"/>

Thanks to

@Katran

[0.5.8]

  • cache image network¬†dependency import fixed
  • Issue #44 Removed print

[0.5.7]

  • cache image network¬†dependency crash fixed

[0.5.5]

  • Video -> Source tag Now Supported
  • flutter_custom_tabs Fixed
  • Updated latest dependencies

[0.5.4]

[0.5.3]

  • Bug fixes

[0.5.2]

  • support for data:image parsing for inline base64 images added

[0.5.1]

  • Bug Fixes

[0.5.0]

  • Video tag is not supported

[0.4.0]

  • Links are clickable now

[0.3.0]

  • Initial release

example/lib/main.dart

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

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

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => new _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    String html = '''
<h1>This is &nbsp;heading 1</h1>
<h2>This is heading 2</h2>
<h3>This is heading 3</h3>
<h4>This is heading 4</h4>
<h5>This is heading 5</h5>
<h6>This is heading 6</h6>
<img alt="Test Image" src="https://source.unsplash.com/random/300x200">
<video src="https://www.sample-videos.com/video/mp4/720/big_buck_bunny_720p_5mb.mp4"></video>
<a data-id="1" href="https://google.com">Go Google</a>
<a href="mailto:ponnamkarthik3@gmail.com">Mail to me</a>

<video id="video1" >
    <source src="https://www.w3schools.com/html/mov_bbb.mp4" type="video/mp4">
 </video>
  
''';

    return new MaterialApp(
      home: new Scaffold(
        appBar: new AppBar(
          title: new Text('Plugin example app'),
        ),
        body: new SingleChildScrollView(
          child: new Center(
            child: new HtmlView(
              data: html,
            ),
          ),
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  flutter_html_view: ^0.5.8

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_html_view/flutter_html_view.dart';
  
Version Uploaded Documentation Archive
0.5.8 Sep 1, 2018 Go to the documentation of flutter_html_view 0.5.8 Download flutter_html_view 0.5.8 archive
0.5.7 Aug 30, 2018 Go to the documentation of flutter_html_view 0.5.7 Download flutter_html_view 0.5.7 archive
0.5.6 Aug 30, 2018 Go to the documentation of flutter_html_view 0.5.6 Download flutter_html_view 0.5.6 archive
0.5.5 Aug 30, 2018 Go to the documentation of flutter_html_view 0.5.5 Download flutter_html_view 0.5.5 archive
0.5.4 Aug 14, 2018 Go to the documentation of flutter_html_view 0.5.4 Download flutter_html_view 0.5.4 archive
0.5.3 Jul 24, 2018 Go to the documentation of flutter_html_view 0.5.3 Download flutter_html_view 0.5.3 archive
0.5.2 Jun 9, 2018 Go to the documentation of flutter_html_view 0.5.2 Download flutter_html_view 0.5.2 archive
0.5.1 May 24, 2018 Go to the documentation of flutter_html_view 0.5.1 Download flutter_html_view 0.5.1 archive
0.5.0 May 24, 2018 Go to the documentation of flutter_html_view 0.5.0 Download flutter_html_view 0.5.0 archive
0.4.0 Apr 22, 2018 Go to the documentation of flutter_html_view 0.4.0 Download flutter_html_view 0.4.0 archive

All 13 versions...

Popularity:
Describes how popular the package is relative to other packages. [more]
96
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]
98
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.

Health suggestions

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

Analysis of lib/flutter_html_text.dart reported 1 hint:

line 6 col 7: This class inherits from a class marked as @immutable, and therefore should be immutable (all instance fields must be final).

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.28.0 <3.0.0
cached_network_image ^0.4.2 0.4.2 0.5.0+1
flutter 0.0.0
flutter_custom_tabs ^0.3.0 0.3.0 0.4.0
html ^0.13.3 0.13.3+3
video_player ^0.6.4 0.6.5 0.7.2
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
url_launcher 3.0.3 4.0.1
utf 0.9.0+5
uuid 1.0.3
vector_math 2.0.8