Skip to content

Commit 247a8f3

Browse files
committed
Allow negative numbers to fix Sub6Resources#97
1 parent c5278bb commit 247a8f3

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
## [0.11.0] - September 6, 2019:
22

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

56
## [0.10.4] - June 22, 2019:
67

lib/rich_text_parser.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -759,8 +759,8 @@ class HtmlRichTextParser extends StatelessWidget {
759759
child: Image.memory(
760760
base64.decode(
761761
node.attributes['src'].split("base64,")[1].trim()),
762-
width: width,
763-
height: height,
762+
width: (width ?? -1) > 0? width: null,
763+
height: (height ?? -1) > 0? width: null,
764764
scale: imageProperties?.scale ?? 1.0,
765765
matchTextDirection:
766766
imageProperties?.matchTextDirection ?? false,
@@ -793,8 +793,8 @@ class HtmlRichTextParser extends StatelessWidget {
793793
parseContext.rootWidgetList.add(GestureDetector(
794794
child: Image.network(
795795
node.attributes['src'],
796-
width: width,
797-
height: height,
796+
width: (width ?? -1) > 0? width: null,
797+
height: (height ?? -1) > 0? height: null,
798798
scale: imageProperties?.scale ?? 1.0,
799799
matchTextDirection:
800800
imageProperties?.matchTextDirection ?? false,

0 commit comments

Comments
 (0)