Skip to content

Commit 03c21aa

Browse files
committed
Version 0.10.2
1 parent 97a671b commit 03c21aa

File tree

5 files changed

+25
-4
lines changed

5 files changed

+25
-4
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## [0.10.2] - June 19, 2019:
2+
3+
* Add `customTextAlign` property ([#112](https://github.com/Sub6Resources/flutter_html/pull/112))
4+
* Use `tryParse` instead of `parse` for image width and height attributes so that `%` values are ignored safely. Fixes [#98](https://github.com/Sub6Resources/flutter_html/issues/98)
5+
16
## [0.10.1] - May 20, 2019:
27

38
* Image properties and onImageTap for the richTextParser, plus some fixes ([#90](https://github.com/Sub6Resources/flutter_html/pull/90))

README.md

Lines changed: 9 additions & 1 deletion
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.1+hotfix.1
15+
flutter_html: ^0.10.2
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`
@@ -85,6 +85,14 @@ Check out the official Flutter WebView package here: https://pub.dartlang.org/pa
8585
}
8686
}
8787
},
88+
customTextAlign: (dom.Node node) {
89+
if (node is dom.Element) {
90+
switch (node.localName) {
91+
case "p":
92+
return TextAlign.justify;
93+
}
94+
}
95+
},
8896
)
8997

9098
## `useRichText` parameter

example/main.dart

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,14 @@ class _MyHomePageState extends State<MyHomePage> {
137137
}
138138
}
139139
},
140+
customTextAlign: (dom.Node node) {
141+
if (node is dom.Element) {
142+
switch (node.localName) {
143+
case "p":
144+
return TextAlign.justify;
145+
}
146+
}
147+
},
140148
),
141149
),
142150
),

lib/html_parser.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -733,11 +733,11 @@ class HtmlRichTextParser extends StatelessWidget {
733733
node.attributes['src'].split("base64,")[1].trim()),
734734
width: imageProperties?.width ??
735735
((node.attributes['width'] != null)
736-
? double.parse(node.attributes['width'])
736+
? double.tryParse(node.attributes['width'])
737737
: null),
738738
height: imageProperties?.height ??
739739
((node.attributes['height'] != null)
740-
? double.parse(node.attributes['height'])
740+
? double.tryParse(node.attributes['height'])
741741
: null),
742742
scale: imageProperties?.scale ?? 1.0,
743743
matchTextDirection:

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: flutter_html
22
description: A Flutter widget for rendering static html tags as Flutter widgets. (Will render over 70 different html tags!)
3-
version: 0.10.1+hotfix.1
3+
version: 0.10.2
44
author: Matthew Whitaker <sub6resources@gmail.com>
55
homepage: https://github.com/Sub6Resources/flutter_html
66

0 commit comments

Comments
 (0)