flutter_html_view 0.5.12

  • Readme
  • Changelog
  • Example
  • Installing
  • 89

flutter_html_view #

Flutter Plugin to render html as a Widget,

Refer this for full support of inline webview for android and iOS

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.11

import 'package:flutter_html_view/flutter_html_view.dart';

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

new HtmlView(
  data: html,
  baseURL: "", // optional, type String
  onLaunchFail: (url) { // optional, type Function
    print("launch $url failed");
  },
  scrollable: false, //false to use MarksownBody and true to use Marksown
)

MarkdownStyleSheet #

styleSheet: MarkdownStyleSheet(

),

styleOptions #

The default and available style options:

NameDefaultOptions
headingStyle"setext""setext", "atx"
hr"* * *""* * *", "- - -", "_ _ _"
bulletListMarker"*""*", "-", "_"
codeBlockStyle"indented""indented", "fenced"
fence"```""```", "~~~"
emDelimiter"_""_", "*"
strongDelimiter"**""**", "__"
linkStyle"inlined""inlined", "referenced"
linkReferenceStyle"full""full", "collapsed", "shortcut"

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 `

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

Thanks to #

@Katran

[0.5.12]

  • add support to change style #93
  • Change flutter_cutom_tabs to 0.6.0 to support AndroidX #91
  • cached_network_image to 0.7.0 #89

[0.5.11]

  • Overflow and maxLines completed #68 by RoughIndustries was merged
  • Update flutter_html_view.dart #67 by RoughIndustries was merged
  • Update flutter_html_text.dart #66 by RoughIndustries was merged
  • htmltext support to change font-size #63 by ZhongJianpeng was merged
  • fixed html image not shown #61 by The-Redhat was merged

[0.5.10]

[0.5.9]

  • add base URL to class constructor to support some Html created by online editor.

[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/README.md

flutter_html_textview_example #

Demonstrates how to use the flutter_html_textview plugin.

Getting Started #

For help getting started with Flutter, view our online documentation.

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.12

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_view/flutter_html_view.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
94
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
60
Overall:
Weighted score of the above. [more]
89
Learn more about scoring.

We analyzed this package on Oct 20, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.5.1
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.4

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Fix lib/flutter_html_view.dart. (-1 points)

Analysis of lib/flutter_html_view.dart reported 2 hints:

line 8 col 7: This class (or a class which this class inherits from) is marked as '@immutable', but one or more of its instance fields are not final: HtmlView.stylingOptions, HtmlView.ctx, HtmlView.styleSheet

line 25 col 7: Don't explicitly initialize variables to null.

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 (or a class which this class inherits from) is marked as '@immutable', but one or more of its instance fields are not final: HtmlText.ctx

Format lib/html_parser.dart.

Run flutter format to format lib/html_parser.dart.

Maintenance issues and suggestions

Support latest dependencies. (-40 points)

The version constraint in pubspec.yaml does not support the latest published versions for 4 dependencies (cached_network_image, html, html2md, video_player).

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.28.0 <3.0.0
cached_network_image ^0.7.0 0.7.0 1.1.2+1
flutter 0.0.0
flutter_custom_tabs ^0.6.0 0.6.0
flutter_markdown ^0.2.0 0.2.0
html ^0.13.3+3 0.13.4+2 0.14.0+3
html2md ^0.3.0 0.3.1 0.5.0
video_player 0.10.0+2 0.10.0+2 0.10.2+5
Transitive dependencies
args 1.5.2
async 2.4.0
charcode 1.1.2
collection 1.14.11 1.14.12
convert 2.1.1
crypto 2.1.3
csslib 0.15.0 0.16.1
flutter_cache_manager 0.3.2 1.1.3
http 0.12.0+2
http_parser 3.1.3
markdown 2.1.1
meta 1.1.7
path 1.6.4
path_provider 0.5.0+1 1.3.1
pedantic 1.8.0+1
sky_engine 0.0.99
source_span 1.5.5
sqflite 1.1.7+1
string_scanner 1.0.5
synchronized 2.1.0+1
term_glyph 1.1.0
typed_data 1.1.6
url_launcher 5.2.3
utf 0.9.0+5
uuid 2.0.2
vector_math 2.0.8