Skip to content

Commit 2e4d2ab

Browse files
committed
Prepare for release
1 parent 18950af commit 2e4d2ab

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## [0.11.0] - September 6, 2019:
1+
## [0.11.0] - September 10, 2019:
22

33
* Make it so `width=100%` doesn't throw error. Fixes [#118](https://github.com/Sub6Resources/flutter_html/issues/118).
44
* You can now set width and/or height in `ImageProperties` to negative to ignore the `width` and/or `height` values from the html. Fixes [#97](https://github.com/Sub6Resources/flutter_html/issues/97)

lib/rich_text_parser.dart

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -738,17 +738,14 @@ class HtmlRichTextParser extends StatelessWidget {
738738
case "img":
739739
if (showImages) {
740740
if (node.attributes['src'] != null) {
741-
742741
final width = imageProperties?.width ??
743742
((node.attributes['width'] != null)
744743
? double.tryParse(node.attributes['width'])
745-
: null
746-
);
744+
: null);
747745
final height = imageProperties?.height ??
748746
((node.attributes['height'] != null)
749747
? double.tryParse(node.attributes['height'])
750-
: null
751-
);
748+
: null);
752749

753750
if (node.attributes['src'].startsWith("data:image") &&
754751
node.attributes['src'].contains("base64,")) {
@@ -759,14 +756,14 @@ class HtmlRichTextParser extends StatelessWidget {
759756
),
760757
),
761758
buildContext,
762-
onError: onImageError ?? (_,__) {},
759+
onError: onImageError ?? (_, __) {},
763760
);
764761
parseContext.rootWidgetList.add(GestureDetector(
765762
child: Image.memory(
766763
base64.decode(
767764
node.attributes['src'].split("base64,")[1].trim()),
768-
width: (width ?? -1) > 0? width: null,
769-
height: (height ?? -1) > 0? width: null,
765+
width: (width ?? -1) > 0 ? width : null,
766+
height: (height ?? -1) > 0 ? width : null,
770767
scale: imageProperties?.scale ?? 1.0,
771768
matchTextDirection:
772769
imageProperties?.matchTextDirection ?? false,
@@ -794,7 +791,7 @@ class HtmlRichTextParser extends StatelessWidget {
794791
precacheImage(
795792
NetworkImage(node.attributes['src']),
796793
buildContext,
797-
onError: onImageError ?? (_,__) {},
794+
onError: onImageError ?? (_, __) {},
798795
);
799796
parseContext.rootWidgetList.add(GestureDetector(
800797
child: Image.network(
@@ -808,16 +805,17 @@ class HtmlRichTextParser extends StatelessWidget {
808805
text: node.attributes['alt'],
809806
style: nextContext.childStyle,
810807
),
811-
)
808+
),
809+
shrinkToFit: shrinkToFit,
812810
);
813811
}
814812
if (frame != null) {
815813
return child;
816814
}
817815
return Container();
818816
},
819-
width: (width ?? -1) > 0? width: null,
820-
height: (height ?? -1) > 0? height: null,
817+
width: (width ?? -1) > 0 ? width : null,
818+
height: (height ?? -1) > 0 ? height : null,
821819
scale: imageProperties?.scale ?? 1.0,
822820
matchTextDirection:
823821
imageProperties?.matchTextDirection ?? false,

0 commit comments

Comments
 (0)