From 0b14b7c30c8678367e8e385bf5b5f7ee1eb7276b Mon Sep 17 00:00:00 2001 From: Ali Ahamed Thowfeek Date: Mon, 1 Feb 2021 22:34:41 +0530 Subject: [PATCH] minor improvement --- CHANGELOG.md | 3 +++ example/lib/main.dart | 1 + example/pubspec.lock | 2 +- lib/src/internals.dart | 7 +++---- pubspec.yaml | 2 +- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 122acb3..3430aa5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +# [3.0.0-nullsafety.3] - Feb 1, 2021 +* Minor render issue fix + ## [3.0.0-nullsafety.2] - Feb 1, 2021 * Fixed an issue with text directly within body tag not rendering diff --git a/example/lib/main.dart b/example/lib/main.dart index 0482d97..1a246d7 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -45,6 +45,7 @@ class Home extends StatelessWidget { home: Scaffold( appBar: AppBar(title: Text("Demo")), body: Container( + color: Colors.white, padding: EdgeInsets.all(16.0), child: RichText(text: textSpan), ), diff --git a/example/pubspec.lock b/example/pubspec.lock index 425292b..f9ba532 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -101,7 +101,7 @@ packages: path: ".." relative: true source: path - version: "3.0.0-nullsafety.2" + version: "3.0.0-nullsafety.3" sky_engine: dependency: transitive description: flutter diff --git a/lib/src/internals.dart b/lib/src/internals.dart index f916399..f75bf33 100644 --- a/lib/src/internals.dart +++ b/lib/src/internals.dart @@ -301,8 +301,7 @@ class Parser { event.name == 'h4' || event.name == 'h5' || event.name == 'h6' || - event.name == 'div' || - event.name == 'body') { + event.name == 'div') { spans.add(TextSpan( text: "\n\n", )); @@ -323,7 +322,7 @@ class Parser { return; } } else { - print("Malformed HTML. No starting TAG"); + print("Malformed HTML. Starting TAG missing"); } } @@ -337,7 +336,7 @@ class Parser { //removing last textSpan to avoid extra space at the bottom if (spans.isNotEmpty) { - spans.removeLast(); + if (spans.last.text == '\n\n') spans.removeLast(); } else { print("Empty HTML content"); } diff --git a/pubspec.yaml b/pubspec.yaml index 4297102..d9186ec 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: simple_html_css description: This package allows you to use simple HTML and inline CSS styles to style your text in flutter. A fork of css_text package. -version: 3.0.0-nullsafety.2 +version: 3.0.0-nullsafety.3 homepage: https://github.com/ali-thowfeek/simple_html_css_flutter repository: https://github.com/ali-thowfeek/simple_html_css_flutter environment: