@@ -16,14 +16,14 @@ CustomRenderMatcher tagMatcher(String tag) => (context) {
16
16
};
17
17
18
18
CustomRenderMatcher blockElementMatcher () => (context) {
19
- return (context.tree.style.display == Display .BLOCK ||
20
- context.tree.style.display == Display .INLINE_BLOCK ) &&
19
+ return (context.tree.style.display == Display .block ||
20
+ context.tree.style.display == Display .inlineBlock ) &&
21
21
(context.tree.children.isNotEmpty ||
22
22
context.tree.element? .localName == "hr" );
23
23
};
24
24
25
25
CustomRenderMatcher listElementMatcher () => (context) {
26
- return context.tree.style.display == Display .LIST_ITEM ;
26
+ return context.tree.style.display == Display .listItem ;
27
27
};
28
28
29
29
CustomRenderMatcher replacedElementMatcher () => (context) {
@@ -44,7 +44,7 @@ CustomRenderMatcher dataUriMatcher(
44
44
};
45
45
46
46
CustomRenderMatcher networkSourceMatcher ({
47
- List <String > schemas: const ["https" , "http" ],
47
+ List <String > schemas = const ["https" , "http" ],
48
48
List <String >? domains,
49
49
String ? extension ,
50
50
}) =>
@@ -81,7 +81,7 @@ CustomRenderMatcher layoutElementMatcher() => (context) {
81
81
82
82
CustomRenderMatcher verticalAlignMatcher () => (context) {
83
83
return context.tree.style.verticalAlign != null &&
84
- context.tree.style.verticalAlign != VerticalAlign .BASELINE ;
84
+ context.tree.style.verticalAlign != VerticalAlign .baseline ;
85
85
};
86
86
87
87
CustomRenderMatcher fallbackMatcher () => (context) {
@@ -120,10 +120,10 @@ CustomRender blockElementRender({Style? style, List<InlineSpan>? children}) =>
120
120
.expandIndexed ((i, childTree) => [
121
121
context.parser.parseTree (context, childTree),
122
122
if (i != context.tree.children.length - 1 &&
123
- childTree.style.display == Display .BLOCK &&
123
+ childTree.style.display == Display .block &&
124
124
childTree.element? .localName != "html" &&
125
125
childTree.element? .localName != "body" )
126
- TextSpan (text: "\n " ),
126
+ const TextSpan (text: "\n " ),
127
127
])
128
128
.toList (),
129
129
);
@@ -136,17 +136,17 @@ CustomRender blockElementRender({Style? style, List<InlineSpan>? children}) =>
136
136
style: style ?? context.tree.style,
137
137
shrinkWrap: context.parser.shrinkWrap,
138
138
childIsReplaced:
139
- REPLACED_EXTERNAL_ELEMENTS .contains (context.tree.name),
139
+ HtmlElements .replacedExternalElements .contains (context.tree.name),
140
140
children: children ??
141
141
context.tree.children
142
142
.expandIndexed ((i, childTree) => [
143
143
context.parser.parseTree (context, childTree),
144
144
//TODO can this newline be added in a different step?
145
145
if (i != context.tree.children.length - 1 &&
146
- childTree.style.display == Display .BLOCK &&
146
+ childTree.style.display == Display .block &&
147
147
childTree.element? .localName != "html" &&
148
148
childTree.element? .localName != "body" )
149
- TextSpan (text: "\n " ),
149
+ const TextSpan (text: "\n " ),
150
150
])
151
151
.toList (),
152
152
),
@@ -168,7 +168,7 @@ CustomRender listElementRender(
168
168
children: [
169
169
(style? .listStylePosition ??
170
170
context.tree.style.listStylePosition) ==
171
- ListStylePosition .OUTSIDE
171
+ ListStylePosition .outside
172
172
? Padding (
173
173
padding: style? .padding? .nonNegative ??
174
174
context.tree.style.padding? .nonNegative ??
@@ -185,15 +185,15 @@ CustomRender listElementRender(
185
185
: 0.0 ),
186
186
child:
187
187
style? .markerContent ?? context.style.markerContent)
188
- : Container (height: 0 , width: 0 ),
189
- Text ("\u 0020" ,
188
+ : const SizedBox (height: 0 , width: 0 ),
189
+ const Text ("\u 0020" ,
190
190
textAlign: TextAlign .right,
191
191
style: TextStyle (fontWeight: FontWeight .w400)),
192
192
Expanded (
193
193
child: Padding (
194
194
padding: (style? .listStylePosition ??
195
195
context.tree.style.listStylePosition) ==
196
- ListStylePosition .INSIDE
196
+ ListStylePosition .inside
197
197
? EdgeInsets .only (
198
198
left: (style? .direction ??
199
199
context.tree.style.direction) !=
@@ -214,13 +214,13 @@ CustomRender listElementRender(
214
214
..insertAll (
215
215
0 ,
216
216
context.tree.style.listStylePosition ==
217
- ListStylePosition .INSIDE
217
+ ListStylePosition .inside
218
218
? [
219
219
WidgetSpan (
220
220
alignment: PlaceholderAlignment .middle,
221
221
child: style? .markerContent ??
222
222
context.style.markerContent ??
223
- Container (height: 0 , width: 0 ))
223
+ const SizedBox (height: 0 , width: 0 ))
224
224
]
225
225
: []),
226
226
style: style ?? context.style,
@@ -370,16 +370,16 @@ CustomRender networkImageRender({
370
370
if (! completer.isCompleted) {
371
371
context.parser.cachedImageSizes[src] = size;
372
372
completer.complete (size);
373
- image.image.resolve (ImageConfiguration ()).removeListener (listener! );
373
+ image.image.resolve (const ImageConfiguration ()).removeListener (listener! );
374
374
}
375
375
}, onError: (object, stacktrace) {
376
376
if (! completer.isCompleted) {
377
377
completer.completeError (object);
378
- image.image.resolve (ImageConfiguration ()).removeListener (listener! );
378
+ image.image.resolve (const ImageConfiguration ()).removeListener (listener! );
379
379
}
380
380
});
381
381
382
- image.image.resolve (ImageConfiguration ()).addListener (listener);
382
+ image.image.resolve (const ImageConfiguration ()).addListener (listener);
383
383
}
384
384
final attributes =
385
385
context.tree.element! .attributes.cast <String , String >();
@@ -487,12 +487,12 @@ CustomRender fallbackRender({Style? style, List<InlineSpan>? children}) =>
487
487
children: context.tree.children
488
488
.expand ((tree) => [
489
489
context.parser.parseTree (context, tree),
490
- if (tree.style.display == Display .BLOCK &&
490
+ if (tree.style.display == Display .block &&
491
491
tree.element? .parent? .localName != "th" &&
492
492
tree.element? .parent? .localName != "td" &&
493
493
tree.element? .localName != "html" &&
494
494
tree.element? .localName != "body" )
495
- TextSpan (text: "\n " ),
495
+ const TextSpan (text: "\n " ),
496
496
])
497
497
.toList (),
498
498
));
@@ -516,8 +516,8 @@ Map<CustomRenderMatcher, CustomRender> generateDefaultRenders() {
516
516
List <InlineSpan > _getListElementChildren (
517
517
ListStylePosition ? position, Function () buildChildren) {
518
518
List <InlineSpan > children = buildChildren.call ();
519
- if (position == ListStylePosition .INSIDE ) {
520
- final tabSpan = WidgetSpan (
519
+ if (position == ListStylePosition .inside ) {
520
+ const tabSpan = WidgetSpan (
521
521
child: Text ("\t " ,
522
522
textAlign: TextAlign .right,
523
523
style: TextStyle (fontWeight: FontWeight .w400)),
@@ -567,13 +567,13 @@ InlineSpan _getInteractableChildren(RenderContext context,
567
567
}
568
568
569
569
final _dataUriFormat = RegExp (
570
- "^(?<scheme>data):(?<mime>image\/ [\\ w\+\-\ . ]+)(?<encoding>;base64)?\, (?<data>.*)" );
570
+ "^(?<scheme>data):(?<mime>image\\ /[\\ w\\ + \\ - \\ .]+)(?<encoding>;base64)?\ \ ,(?<data>.*)" );
571
571
572
572
double _getVerticalOffset (StyledElement tree) {
573
573
switch (tree.style.verticalAlign) {
574
- case VerticalAlign .SUB :
574
+ case VerticalAlign .sub :
575
575
return tree.style.fontSize! .value / 2.5 ;
576
- case VerticalAlign .SUPER :
576
+ case VerticalAlign .sup :
577
577
return tree.style.fontSize! .value / - 2.5 ;
578
578
default :
579
579
return 0 ;
@@ -618,5 +618,5 @@ double _aspectRatio(
618
618
619
619
extension ClampedEdgeInsets on EdgeInsetsGeometry {
620
620
EdgeInsetsGeometry get nonNegative =>
621
- this . clamp (EdgeInsets .zero, const EdgeInsets .all (double .infinity));
621
+ clamp (EdgeInsets .zero, const EdgeInsets .all (double .infinity));
622
622
}
0 commit comments