@@ -28,7 +28,7 @@ typedef OnMathError = Widget Function(
28
28
String exception,
29
29
String exceptionWithType,
30
30
);
31
- typedef OnCSSParseError = String ? Function (
31
+ typedef OnCssParseError = String ? Function (
32
32
String css,
33
33
List <cssparser.Message > errors,
34
34
);
@@ -42,7 +42,7 @@ class HtmlParser extends StatelessWidget {
42
42
final dom.Document htmlData;
43
43
final OnTap ? onLinkTap;
44
44
final OnTap ? onImageTap;
45
- final OnCSSParseError ? onCSSParseError ;
45
+ final OnCssParseError ? onCssParseError ;
46
46
final ImageErrorListener ? onImageError;
47
47
final OnMathError ? onMathError;
48
48
final bool shrinkWrap;
@@ -59,7 +59,7 @@ class HtmlParser extends StatelessWidget {
59
59
required this .htmlData,
60
60
required this .onLinkTap,
61
61
required this .onImageTap,
62
- required this .onCSSParseError ,
62
+ required this .onCssParseError ,
63
63
required this .onImageError,
64
64
required this .onMathError,
65
65
required this .shrinkWrap,
@@ -72,18 +72,18 @@ class HtmlParser extends StatelessWidget {
72
72
73
73
@override
74
74
Widget build (BuildContext context) {
75
- Map <String , Map <String , List <css.Expression >>> declarations = _getExternalCSSDeclarations (htmlData.getElementsByTagName ("style" ), onCSSParseError );
75
+ Map <String , Map <String , List <css.Expression >>> declarations = _getExternalCssDeclarations (htmlData.getElementsByTagName ("style" ), onCssParseError );
76
76
StyledElement lexedTree = lexDomTree (
77
77
htmlData,
78
78
customRender.keys.toList (),
79
79
tagsList,
80
80
navigationDelegateForIframe,
81
81
);
82
- StyledElement ? externalCSSStyledTree ;
82
+ StyledElement ? externalCssStyledTree ;
83
83
if (declarations.isNotEmpty) {
84
- externalCSSStyledTree = _applyExternalCSS (declarations, lexedTree);
84
+ externalCssStyledTree = _applyExternalCss (declarations, lexedTree);
85
85
}
86
- StyledElement inlineStyledTree = _applyInlineStyles (externalCSSStyledTree ?? lexedTree, onCSSParseError );
86
+ StyledElement inlineStyledTree = _applyInlineStyles (externalCssStyledTree ?? lexedTree, onCssParseError );
87
87
StyledElement customStyledTree = _applyCustomStyles (style, inlineStyledTree);
88
88
StyledElement cascadedStyledTree = _cascadeStyles (style, customStyledTree);
89
89
StyledElement cleanedTree = cleanTree (cascadedStyledTree);
@@ -119,8 +119,8 @@ class HtmlParser extends StatelessWidget {
119
119
return htmlparser.parse (data);
120
120
}
121
121
122
- /// [parseCSS ] converts a string of CSS to a CSS stylesheet using the dart `csslib` library.
123
- static css.StyleSheet parseCSS (String data) {
122
+ /// [parseCss ] converts a string of CSS to a CSS stylesheet using the dart `csslib` library.
123
+ static css.StyleSheet parseCss (String data) {
124
124
return cssparser.parse (data);
125
125
}
126
126
@@ -200,34 +200,34 @@ class HtmlParser extends StatelessWidget {
200
200
}
201
201
}
202
202
203
- static Map <String , Map <String , List <css.Expression >>> _getExternalCSSDeclarations (List <dom.Element > styles, OnCSSParseError ? errorHandler) {
204
- String fullCSS = "" ;
203
+ static Map <String , Map <String , List <css.Expression >>> _getExternalCssDeclarations (List <dom.Element > styles, OnCssParseError ? errorHandler) {
204
+ String fullCss = "" ;
205
205
for (final e in styles) {
206
- fullCSS = fullCSS + e.innerHtml;
206
+ fullCss = fullCss + e.innerHtml;
207
207
}
208
- if (fullCSS .isNotEmpty) {
209
- final declarations = parseExternalCSS (fullCSS , errorHandler);
208
+ if (fullCss .isNotEmpty) {
209
+ final declarations = parseExternalCss (fullCss , errorHandler);
210
210
return declarations;
211
211
} else {
212
212
return {};
213
213
}
214
214
}
215
215
216
- static StyledElement _applyExternalCSS (Map <String , Map <String , List <css.Expression >>> declarations, StyledElement tree) {
216
+ static StyledElement _applyExternalCss (Map <String , Map <String , List <css.Expression >>> declarations, StyledElement tree) {
217
217
declarations.forEach ((key, style) {
218
218
if (tree.matchesSelector (key)) {
219
219
tree.style = tree.style.merge (declarationsToStyle (style));
220
220
}
221
221
});
222
222
223
- tree.children.forEach ((e) => _applyExternalCSS (declarations, e));
223
+ tree.children.forEach ((e) => _applyExternalCss (declarations, e));
224
224
225
225
return tree;
226
226
}
227
227
228
- static StyledElement _applyInlineStyles (StyledElement tree, OnCSSParseError ? errorHandler) {
228
+ static StyledElement _applyInlineStyles (StyledElement tree, OnCssParseError ? errorHandler) {
229
229
if (tree.attributes.containsKey ("style" )) {
230
- final newStyle = inlineCSSToStyle (tree.attributes['style' ], errorHandler);
230
+ final newStyle = inlineCssToStyle (tree.attributes['style' ], errorHandler);
231
231
if (newStyle != null ) {
232
232
tree.style = tree.style.merge (newStyle);
233
233
}
0 commit comments