Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions lib/src/replaced_element.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'dart:convert';
import 'dart:io';
import 'dart:math';

import 'package:chewie/chewie.dart';
Expand Down Expand Up @@ -114,6 +115,24 @@ class ImageContentElement extends ReplacedElement {
return child;
},
);
} else if (src.startsWith("file:")) {
final File file = File(src.replaceFirst('file:', ''));
precacheImage(
FileImage(file),
context.buildContext,
onError: (exception, StackTrace stackTrace) {
context.parser.onImageError?.call(exception, stackTrace);
},
);
imageWidget = Image.file(
file,
frameBuilder: (ctx, child, frame, _) {
if (frame == null) {
return Text(alt ?? "", style: context.style.generateTextStyle());
}
return child;
},
);
} else {
precacheImage(
NetworkImage(src),
Expand Down