Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Inline style with "text-shadow" in some case will parse failed. #834

Closed
windows7lake opened this issue Sep 10, 2021 · 3 comments
Closed
Labels
bug Something isn't working

Comments

@windows7lake
Copy link
Contributor

windows7lake commented Sep 10, 2021

Describe the bug:
Using the code as follow will parse failed, and the code was generated by some kind of editor.

text-shadow: #FC0 1px 0 10px;
text-shadow: red 2px 5px;
text-shadow: none;

report that

======== Exception caught by widgets library =======================================================
The following _CastError was thrown building HtmlParser-[GlobalKey#fb3cb](dirty, dependencies: [_LocalizationsScope-[GlobalKey#d5a1c], _InheritedTheme]):
Null check operator used on a null value

The relevant error-causing widget was: 
  HtmlParser-[GlobalKey#fb3cb] file:///Users/xxxx/Workspace/FlutterWorker/flutter_html/lib/flutter_html.dart:159:14
When the exception was thrown, this was the stack: 
#0      ExpressionMapping.expressionToTextShadow (package:flutter_html/src/css_parser.dart:832:88)
#1      declarationsToStyle.<anonymous closure> (package:flutter_html/src/css_parser.dart:299:48)
#2      _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:397:8)
#3      declarationsToStyle (package:flutter_html/src/css_parser.dart:14:16)
#4      inlineCssToStyle (package:flutter_html/src/css_parser.dart:312:12)
...
====================================================================================================

HTML to reproduce the issue:

<p style="text-shadow: red 2px 5px;">Test</p>

Just add this code to example.

Html widget configuration:
the same as example.

Expected behavior:
Parse correct. With some code like "text-shadow: red 2px 5px;", it can be parsed as follow:
image

@windows7lake windows7lake added the bug Something isn't working label Sep 10, 2021
windows7lake pushed a commit to windows7lake/flutter_html that referenced this issue Sep 10, 2021
erickok added a commit that referenced this issue Oct 1, 2021
Fix issue #834 Inline style with "text-shadow" parse failed.
@erickok
Copy link
Collaborator

erickok commented Nov 29, 2021

Should be fixed in 2.2.0.

@erickok erickok closed this as completed Nov 29, 2021
@abcdsxg
Copy link

abcdsxg commented Aug 23, 2022

text-shadow: rgb(2, 0, 171) 1px 0px, rgb(2, 0, 171) -1px 0px, rgb(2, 0, 171) 0px 1px, rgb(2, 0, 171) 0px -1px;

Not supported this style?

Null check operator used on a null value

The relevant error-causing widget was: 
  Html Html:file:///Users/shingle/ws/android/foresightnews/lib/pages/detail/articleDetail.dart:207:30
When the exception was thrown, this was the stack: 
#0      ExpressionMapping.expressionToTextShadow (package:flutter_html/src/css_parser.dart:901:100)
#1      declarationsToStyle.<anonymous closure> (package:flutter_html/src/css_parser.dart:339:48)

@Sub6Resources
Copy link
Owner

@abcdsxg It's possible the rgb keyword still might have some issues, as well as the comma separated list of text shadows. I've opened a new issue for this in #1130.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants