Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
## [0.6.0]

- updated Dependencies: [#99](https://github.com/PonnamKarthik/FlutterHtmlView/pull/99).
- html: ^0.14.0+3
- video_player: 0.10.7
- cached_network_image: ^2.0.0
- flutter_markdown: ^0.3.3
- html2md: ^0.5.1

## [0.5.12]

- add support to change style #93
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Flutter has no default support to render html so this package helps you to rende

```yaml
dependencies:
flutter_html_view: ^0.5.11
flutter_html_view: ^0.6.0
```

```dart
Expand Down
40 changes: 1 addition & 39 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,54 +1,16 @@
name: flutter_html_view_example
description: Demonstrates how to use the flutter_html_textview plugin.
description: Demonstrates how to use the flutter_html_view plugin.

dependencies:
flutter:
sdk: flutter

# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.2

dev_dependencies:
flutter_test:
sdk: flutter

flutter_html_view:
path: ../

# For information on the generic Dart part of this file, see the
# following page: https://www.dartlang.org/tools/pub/pubspec

# The following section is specific to Flutter.
flutter:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true
# To add assets to your application, add an assets section, like this:
# assets:
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.io/assets-and-images/#resolution-aware.
# For details regarding adding assets from package dependencies, see
# https://flutter.io/assets-and-images/#from-packages
# To add custom fonts to your application, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts from package dependencies,
# see https://flutter.io/custom-fonts/#from-packages
13 changes: 9 additions & 4 deletions lib/flutter_html_text.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@ class HtmlText extends StatelessWidget {

BuildContext ctx;

HtmlText({this.data, this.style, this.onLaunchFail, this.overflow, this.maxLines});
HtmlText({
this.data,
this.style,
this.onLaunchFail,
this.overflow,
this.maxLines,
});

void _launchURL(String url) async {
try {
Expand Down Expand Up @@ -62,7 +68,6 @@ class HtmlText extends StatelessWidget {

TextSpan span = this._stackToTextSpan(nodes, context);


RichText contents;
if (overflow != null && maxLines != null) {
contents = new RichText(
Expand Down Expand Up @@ -520,8 +525,8 @@ class HtmlParser {
break;

case 'font-size':
fontSize = double.parse(value);
fontSize = double.parse(value);

break;

case 'text-decoration':
Expand Down
20 changes: 10 additions & 10 deletions lib/flutter_html_view.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import 'package:flutter/material.dart';

import 'package:html2md/html2md.dart' as html2md;
import 'package:flutter_markdown/flutter_markdown.dart';
import 'package:flutter_custom_tabs/flutter_custom_tabs.dart' as cTab;
import 'package:flutter_markdown/flutter_markdown.dart';
import 'package:html2md/html2md.dart' as html2md;
import 'package:url_launcher/url_launcher.dart';

class HtmlView extends StatelessWidget {
Expand All @@ -16,13 +15,14 @@ class HtmlView extends StatelessWidget {

/// If [scrollable] is set to false then you must handle scrolling outside of this widget.
/// This can be acheived by using a [SingleChildScrollView].
HtmlView(
{this.data,
this.stylingOptions,
this.onLaunchFail,
this.scrollable = true,
this.padding,
this.styleSheet = null});
HtmlView({
this.data,
this.stylingOptions,
this.onLaunchFail,
this.scrollable = true,
this.padding,
this.styleSheet,
});

@override
Widget build(BuildContext context) {
Expand Down
7 changes: 6 additions & 1 deletion lib/html_parser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,12 @@ class HtmlParser {
} else if (!e.outerHtml.contains("<img") ||
!e.outerHtml.contains("<video") ||
!e.hasContent()) {
widgetList.add(new HtmlText(data: e.outerHtml, onLaunchFail: this.onLaunchFail, overflow: this.overflow, maxLines: this.maxLines,));
widgetList.add(new HtmlText(
data: e.outerHtml,
onLaunchFail: this.onLaunchFail,
overflow: this.overflow,
maxLines: this.maxLines,
));
} else if (e.children.length > 0)
e.children.forEach((e) => _parseChildren(e, widgetList));
}
Expand Down
17 changes: 8 additions & 9 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
name: flutter_html_view
description: Flutter Plugin to render html, Flutter has no default support to render html so this package helps you to render your html to native widgets
version: 0.5.12
version: 0.6.0
author: Karthik Ponnam <[email protected]>
homepage: https://github.com/PonnamKarthik/FlutterHtmlView

dependencies:
flutter:
sdk: flutter
flutter_custom_tabs: ^0.6.0
html: ^0.13.3+3
video_player: 0.10.0+2
cached_network_image: ^0.7.0

flutter_markdown: ^0.2.0
html2md: ^0.3.0
html: ^0.14.0+3
video_player: ^0.10.7
cached_network_image: ^2.0.0
flutter_markdown: ^0.3.3
html2md: ^0.5.1

environment:
sdk: ">=2.0.0-dev.28.0 <3.0.0"
flutter: ">=0.1.4 <2.0.0"
sdk: ">=2.2.2 <3.0.0"
flutter: ">=1.10.7 <2.0.0"