Skip to content

Commit 38a7739

Browse files
committed
Fixes Sub6Resources#116; Version 0.10.4
1 parent b660787 commit 38a7739

File tree

8 files changed

+1027
-976
lines changed

8 files changed

+1027
-976
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## [0.10.4] - June 22, 2019:
2+
3+
* Add support for `customTextStyle` to block and specialty HTML elements.
4+
15
## [0.10.3] - June 20, 2019:
26

37
* Add `src` to the `onImageTap` callback ([#93](https://github.com/Sub6Resources/flutter_html/pull/93))

README.md

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ A Flutter widget for rendering static html tags as Flutter widgets. (Will render
1212
Add the following to your `pubspec.yaml` file:
1313

1414
dependencies:
15-
flutter_html: ^0.10.3
15+
flutter_html: ^0.10.4
1616

1717
## Currently Supported HTML Tags:
1818
`a`, `abbr`, `acronym`, `address`, `article`, `aside`, `b`, `bdi`, `bdo`, `big`, `blockquote`, `body`, `br`, `caption`, `cite`, `code`, `data`, `dd`, `del`, `dfn`, `div`, `dl`, `dt`, `em`, `figcaption`, `figure`, `footer`, `h1`, `h2`, `h3`, `h4`, `h5`, `h6`, `header`, `hr`, `i`, `img`, `ins`, `kbd`, `li`, `main`, `mark`, `nav`, `noscript`, `ol`, `p`, `pre`, `q`, `rp`, `rt`, `ruby`, `s`, `samp`, `section`, `small`, `span`, `strike`, `strong`, `sub`, `sup`, `table`, `tbody`, `td`, `template`, `tfoot`, `th`, `thead`, `time`, `tr`, `tt`, `u`, `ul`, `var`
@@ -90,13 +90,22 @@ Check out the official Flutter WebView package here: https://pub.dartlang.org/pa
9090
}
9191
},
9292
customTextAlign: (dom.Node node) {
93-
if (node is dom.Element) {
94-
switch (node.localName) {
95-
case "p":
96-
return TextAlign.justify;
97-
}
93+
if (node is dom.Element) {
94+
switch (node.localName) {
95+
case "p":
96+
return TextAlign.justify;
9897
}
99-
},
98+
}
99+
},
100+
customTextStyle: (dom.Node node, TextStyle baseStyle) {
101+
if (node is dom.Element) {
102+
switch (node.localName) {
103+
case "p":
104+
return baseStyle.merge(TextStyle(height: 2, fontSize: 20));
105+
}
106+
}
107+
return baseStyle;
108+
},
100109
)
101110

102111
## `useRichText` parameter

example/main.dart

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ class _MyHomePageState extends State<MyHomePage> {
140140
return Column(children: children);
141141
}
142142
}
143+
return null;
143144
},
144145
customTextAlign: (dom.Node node) {
145146
if (node is dom.Element) {
@@ -148,6 +149,16 @@ class _MyHomePageState extends State<MyHomePage> {
148149
return TextAlign.justify;
149150
}
150151
}
152+
return null;
153+
},
154+
customTextStyle: (dom.Node node, TextStyle baseStyle) {
155+
if (node is dom.Element) {
156+
switch (node.localName) {
157+
case "p":
158+
return baseStyle.merge(TextStyle(height: 2, fontSize: 20));
159+
}
160+
}
161+
return baseStyle;
151162
},
152163
),
153164
),

lib/flutter_html.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ library flutter_html;
22

33
import 'package:flutter/material.dart';
44
import 'package:flutter_html/html_parser.dart';
5+
import 'package:flutter_html/rich_text_parser.dart';
56
import 'image_properties.dart';
67

78
class Html extends StatelessWidget {

0 commit comments

Comments
 (0)