Skip to content

Commit 221100a

Browse files
committed
Added empty content validation. fixes #4
1 parent 51d7e9a commit 221100a

File tree

7 files changed

+54
-43
lines changed

7 files changed

+54
-43
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
# [2.0.0+3] - Oct 20th, 2020
1+
# [2.0.0+4] - Jan 27th, 2021
2+
3+
* Fixed empty string error
4+
5+
## [2.0.0+3] - Oct 20th, 2020
26

37
* Updated dependencies
48

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
This is a fork of [css_text_for_flutter](https://github.com/hathibelagal-dev/css_text_for_flutter)
66

7-
This package makes it easy for you to convert HTML and CSS text content
7+
This package makes it easy for you to convert HTML with inline CSS content
88
into `RichText` widgets. It supports most CSS properties that are
99
relevant to **text** content, except for a few. Also gives the ability to
1010
override the styles of the content passed in.

example/.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ unlinked_spec.ds
9292
**/ios/Flutter/flutter_export_environment.sh
9393
**/ios/ServiceDefinitions.json
9494
**/ios/Runner/GeneratedPluginRegistrant.*
95+
**/ios/Flutter/.last_build_id
96+
9597

9698
# macOS
9799
**/macos/Flutter/GeneratedPluginRegistrant.swift
@@ -111,4 +113,4 @@ app.*.symbols
111113
!**/ios/**/default.pbxuser
112114
!**/ios/**/default.perspectivev3
113115
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
114-
!/dev/ci/**/Gemfile.lock
116+
!/dev/ci/**/Gemfile.lock

example/pubspec.lock

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,42 +7,42 @@ packages:
77
name: async
88
url: "https://pub.dartlang.org"
99
source: hosted
10-
version: "2.4.2"
10+
version: "2.5.0-nullsafety.1"
1111
boolean_selector:
1212
dependency: transitive
1313
description:
1414
name: boolean_selector
1515
url: "https://pub.dartlang.org"
1616
source: hosted
17-
version: "2.0.0"
17+
version: "2.1.0-nullsafety.1"
1818
characters:
1919
dependency: transitive
2020
description:
2121
name: characters
2222
url: "https://pub.dartlang.org"
2323
source: hosted
24-
version: "1.0.0"
24+
version: "1.1.0-nullsafety.3"
2525
charcode:
2626
dependency: transitive
2727
description:
2828
name: charcode
2929
url: "https://pub.dartlang.org"
3030
source: hosted
31-
version: "1.1.3"
31+
version: "1.2.0-nullsafety.1"
3232
clock:
3333
dependency: transitive
3434
description:
3535
name: clock
3636
url: "https://pub.dartlang.org"
3737
source: hosted
38-
version: "1.0.1"
38+
version: "1.1.0-nullsafety.1"
3939
collection:
4040
dependency: transitive
4141
description:
4242
name: collection
4343
url: "https://pub.dartlang.org"
4444
source: hosted
45-
version: "1.14.13"
45+
version: "1.15.0-nullsafety.3"
4646
convert:
4747
dependency: transitive
4848
description:
@@ -63,7 +63,7 @@ packages:
6363
name: fake_async
6464
url: "https://pub.dartlang.org"
6565
source: hosted
66-
version: "1.1.0"
66+
version: "1.2.0-nullsafety.1"
6767
flutter:
6868
dependency: "direct main"
6969
description: flutter
@@ -87,21 +87,21 @@ packages:
8787
name: matcher
8888
url: "https://pub.dartlang.org"
8989
source: hosted
90-
version: "0.12.8"
90+
version: "0.12.10-nullsafety.1"
9191
meta:
9292
dependency: transitive
9393
description:
9494
name: meta
9595
url: "https://pub.dartlang.org"
9696
source: hosted
97-
version: "1.1.8"
97+
version: "1.3.0-nullsafety.3"
9898
path:
9999
dependency: transitive
100100
description:
101101
name: path
102102
url: "https://pub.dartlang.org"
103103
source: hosted
104-
version: "1.7.0"
104+
version: "1.8.0-nullsafety.1"
105105
petitparser:
106106
dependency: transitive
107107
description:
@@ -115,7 +115,7 @@ packages:
115115
path: ".."
116116
relative: true
117117
source: path
118-
version: "2.0.0+3"
118+
version: "2.0.0+4"
119119
sky_engine:
120120
dependency: transitive
121121
description: flutter
@@ -127,56 +127,56 @@ packages:
127127
name: source_span
128128
url: "https://pub.dartlang.org"
129129
source: hosted
130-
version: "1.7.0"
130+
version: "1.8.0-nullsafety.2"
131131
stack_trace:
132132
dependency: transitive
133133
description:
134134
name: stack_trace
135135
url: "https://pub.dartlang.org"
136136
source: hosted
137-
version: "1.9.5"
137+
version: "1.10.0-nullsafety.1"
138138
stream_channel:
139139
dependency: transitive
140140
description:
141141
name: stream_channel
142142
url: "https://pub.dartlang.org"
143143
source: hosted
144-
version: "2.0.0"
144+
version: "2.1.0-nullsafety.1"
145145
string_scanner:
146146
dependency: transitive
147147
description:
148148
name: string_scanner
149149
url: "https://pub.dartlang.org"
150150
source: hosted
151-
version: "1.0.5"
151+
version: "1.1.0-nullsafety.1"
152152
term_glyph:
153153
dependency: transitive
154154
description:
155155
name: term_glyph
156156
url: "https://pub.dartlang.org"
157157
source: hosted
158-
version: "1.1.0"
158+
version: "1.2.0-nullsafety.1"
159159
test_api:
160160
dependency: transitive
161161
description:
162162
name: test_api
163163
url: "https://pub.dartlang.org"
164164
source: hosted
165-
version: "0.2.17"
165+
version: "0.2.19-nullsafety.2"
166166
typed_data:
167167
dependency: transitive
168168
description:
169169
name: typed_data
170170
url: "https://pub.dartlang.org"
171171
source: hosted
172-
version: "1.2.0"
172+
version: "1.3.0-nullsafety.3"
173173
vector_math:
174174
dependency: transitive
175175
description:
176176
name: vector_math
177177
url: "https://pub.dartlang.org"
178178
source: hosted
179-
version: "2.0.8"
179+
version: "2.1.0-nullsafety.3"
180180
xml:
181181
dependency: transitive
182182
description:
@@ -185,4 +185,4 @@ packages:
185185
source: hosted
186186
version: "4.5.1"
187187
sdks:
188-
dart: ">=2.9.0-14.0.dev <3.0.0"
188+
dart: ">=2.10.0-110 <2.11.0"

lib/src/html_stylist.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@ class HTML {
6060
{Function linksCallback,
6161
Map<String, TextStyle> overrideStyle,
6262
TextStyle defaultTextStyle}) {
63+
//Validating empty content
64+
if (htmlContent.isEmpty) {
65+
return TextSpan();
66+
}
67+
6368
//to fix a known issue with &nbsp; when appearing after an ending tag
6469
htmlContent =
6570
htmlContent.replaceAll("&nbsp;", " ").replaceAll("&nbsp", " ");

pubspec.lock

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,42 +7,42 @@ packages:
77
name: async
88
url: "https://pub.dartlang.org"
99
source: hosted
10-
version: "2.4.2"
10+
version: "2.5.0-nullsafety.1"
1111
boolean_selector:
1212
dependency: transitive
1313
description:
1414
name: boolean_selector
1515
url: "https://pub.dartlang.org"
1616
source: hosted
17-
version: "2.0.0"
17+
version: "2.1.0-nullsafety.1"
1818
characters:
1919
dependency: transitive
2020
description:
2121
name: characters
2222
url: "https://pub.dartlang.org"
2323
source: hosted
24-
version: "1.0.0"
24+
version: "1.1.0-nullsafety.3"
2525
charcode:
2626
dependency: transitive
2727
description:
2828
name: charcode
2929
url: "https://pub.dartlang.org"
3030
source: hosted
31-
version: "1.1.3"
31+
version: "1.2.0-nullsafety.1"
3232
clock:
3333
dependency: transitive
3434
description:
3535
name: clock
3636
url: "https://pub.dartlang.org"
3737
source: hosted
38-
version: "1.0.1"
38+
version: "1.1.0-nullsafety.1"
3939
collection:
4040
dependency: transitive
4141
description:
4242
name: collection
4343
url: "https://pub.dartlang.org"
4444
source: hosted
45-
version: "1.14.13"
45+
version: "1.15.0-nullsafety.3"
4646
convert:
4747
dependency: transitive
4848
description:
@@ -56,7 +56,7 @@ packages:
5656
name: fake_async
5757
url: "https://pub.dartlang.org"
5858
source: hosted
59-
version: "1.1.0"
59+
version: "1.2.0-nullsafety.1"
6060
flutter:
6161
dependency: "direct main"
6262
description: flutter
@@ -80,21 +80,21 @@ packages:
8080
name: matcher
8181
url: "https://pub.dartlang.org"
8282
source: hosted
83-
version: "0.12.8"
83+
version: "0.12.10-nullsafety.1"
8484
meta:
8585
dependency: transitive
8686
description:
8787
name: meta
8888
url: "https://pub.dartlang.org"
8989
source: hosted
90-
version: "1.1.8"
90+
version: "1.3.0-nullsafety.3"
9191
path:
9292
dependency: transitive
9393
description:
9494
name: path
9595
url: "https://pub.dartlang.org"
9696
source: hosted
97-
version: "1.7.0"
97+
version: "1.8.0-nullsafety.1"
9898
petitparser:
9999
dependency: transitive
100100
description:
@@ -113,56 +113,56 @@ packages:
113113
name: source_span
114114
url: "https://pub.dartlang.org"
115115
source: hosted
116-
version: "1.7.0"
116+
version: "1.8.0-nullsafety.2"
117117
stack_trace:
118118
dependency: transitive
119119
description:
120120
name: stack_trace
121121
url: "https://pub.dartlang.org"
122122
source: hosted
123-
version: "1.9.5"
123+
version: "1.10.0-nullsafety.1"
124124
stream_channel:
125125
dependency: transitive
126126
description:
127127
name: stream_channel
128128
url: "https://pub.dartlang.org"
129129
source: hosted
130-
version: "2.0.0"
130+
version: "2.1.0-nullsafety.1"
131131
string_scanner:
132132
dependency: transitive
133133
description:
134134
name: string_scanner
135135
url: "https://pub.dartlang.org"
136136
source: hosted
137-
version: "1.0.5"
137+
version: "1.1.0-nullsafety.1"
138138
term_glyph:
139139
dependency: transitive
140140
description:
141141
name: term_glyph
142142
url: "https://pub.dartlang.org"
143143
source: hosted
144-
version: "1.1.0"
144+
version: "1.2.0-nullsafety.1"
145145
test_api:
146146
dependency: transitive
147147
description:
148148
name: test_api
149149
url: "https://pub.dartlang.org"
150150
source: hosted
151-
version: "0.2.17"
151+
version: "0.2.19-nullsafety.2"
152152
typed_data:
153153
dependency: transitive
154154
description:
155155
name: typed_data
156156
url: "https://pub.dartlang.org"
157157
source: hosted
158-
version: "1.2.0"
158+
version: "1.3.0-nullsafety.3"
159159
vector_math:
160160
dependency: transitive
161161
description:
162162
name: vector_math
163163
url: "https://pub.dartlang.org"
164164
source: hosted
165-
version: "2.0.8"
165+
version: "2.1.0-nullsafety.3"
166166
xml:
167167
dependency: "direct main"
168168
description:
@@ -171,4 +171,4 @@ packages:
171171
source: hosted
172172
version: "4.5.1"
173173
sdks:
174-
dart: ">=2.9.0-14.0.dev <3.0.0"
174+
dart: ">=2.10.0-110 <2.11.0"

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: simple_html_css
22
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.
3-
version: 2.0.0+3
3+
version: 2.0.0+4
44
homepage: https://github.com/ali-thowfeek/simple_html_css_flutter
55
repository: https://github.com/ali-thowfeek/simple_html_css_flutter
66
environment:

0 commit comments

Comments
 (0)