File tree Expand file tree Collapse file tree 1 file changed +16
-5
lines changed Expand file tree Collapse file tree 1 file changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -74,23 +74,34 @@ class ImageContentElement extends ReplacedElement {
74
74
75
75
@override
76
76
Widget toWidget (RenderContext context) {
77
- if (src == null )
77
+ if (src == null ) {
78
78
return Text (alt ?? "" , style: context.style.generateTextStyle ());
79
- if (src.startsWith ("data:image" ) && src.contains ("base64," )) {
79
+ } else if (src.startsWith ("data:image" ) && src.contains ("base64," )) {
80
80
return Image .memory (base64.decode (src.split ("base64," )[1 ].trim ()));
81
+ } else if (src.startsWith ("asset:" )) {
82
+ final assetPath = src.replaceFirst ('asset:' , '' );
83
+ //TODO precache image
84
+ return Image .asset (
85
+ assetPath,
86
+ frameBuilder: (ctx, child, frame, _) {
87
+ if (frame == null ) {
88
+ return Text (alt ?? "" , style: context.style.generateTextStyle ());
89
+ }
90
+ return child;
91
+ },
92
+ );
81
93
} else {
94
+ //TODO precache image
82
95
return Image .network (
83
96
src,
84
- frameBuilder: (ctx, child, frame, something ) {
97
+ frameBuilder: (ctx, child, frame, _ ) {
85
98
if (frame == null ) {
86
99
return Text (alt ?? "" , style: context.style.generateTextStyle ());
87
100
}
88
-
89
101
return child;
90
102
},
91
103
);
92
104
}
93
- //TODO(Sub6Resources): precacheImage
94
105
}
95
106
}
96
107
You can’t perform that action at this time.
0 commit comments