@@ -10,7 +10,6 @@ import 'package:flutter_svg/flutter_svg.dart';
10
10
// TODO re-add MultipleGestureDetector for image taps in this extension
11
11
12
12
class SvgHtmlExtension extends Extension {
13
-
8000
code>
14
13
final String ? dataEncoding;
15
14
final String ? dataMimeType;
16
15
final List <String > networkSchemas;
@@ -34,11 +33,11 @@ class SvgHtmlExtension extends Extension {
34
33
35
34
@override
36
35
bool matches (ExtensionContext context) {
37
- if (! supportedTags.contains (context.elementName)) {
36
+ if (! supportedTags.contains (context.elementName)) {
38
37
return false ;
39
38
}
40
39
41
- if (context.elementName == "svg" ) {
40
+ if (context.elementName == "svg" ) {
42
41
return true ;
43
42
}
44
43
@@ -51,7 +50,7 @@ class SvgHtmlExtension extends Extension {
51
50
bool _matchesSvgDataUri (ExtensionContext context) {
52
51
final attributes = context.attributes;
53
52
54
- if (attributes['src' ] == null ) {
53
+ if (attributes['src' ] == null ) {
55
54
return false ;
56
55
}
57
56
@@ -60,28 +59,27 @@ class SvgHtmlExtension extends Extension {
60
59
return context.elementName == "img" &&
61
60
dataUri != null &&
62
61
(dataMimeType == null || dataUri.namedGroup ('mime' ) == dataMimeType) &&
63
- (dataEncoding == null || dataUri.namedGroup ('encoding' ) == dataEncoding);
62
+ (dataEncoding == null ||
63
+ dataUri.namedGroup ('encoding' ) == dataEncoding);
64
64
}
65
65
66
66
/// Matches an <img> tag with an svg network image
67
67
bool _matchesSvgNetworkSource (ExtensionContext context) {
68
68
final attributes = context.attributes;
69
69
70
- if (attributes['src' ] == null ) {
70
+ if (attributes['src' ] == null ) {
71
71
return false ;
72
72
}
73
73
74
-
75
74
final src = Uri .tryParse (attributes['src' ]! );
76
- if (src == null ) {
75
+ if (src == null ) {
77
76
return false ;
78
77
}
79
78
80
79
return context.elementName == "img" &&
81
80
networkSchemas.contains (src.scheme) &&
82
81
(networkDomains == null || networkDomains! .contains (src.host)) &&
83
82
(extension == null || src.path.endsWith (".$extension " ));
84
-
85
83
}
86
84
87
85
/// Matches an <img> tag with an svg asset image
@@ -142,7 +140,7 @@ class SvgHtmlExtension extends Extension {
142
140
widget = _renderAssetSvg (context);
143
141
} else if (_matchesSvgDataUri (context)) {
144
142
widget = _renderDataSvg (context);
145
- } else if (_matchesSvgNetworkSource (context)){
143
+ } else if (_matchesSvgNetworkSource (context)) {
146
144
widget = _renderNetworkSvg (context);
147
145
}
148
146
}
0 commit comments