From b04f31e118dc568e7492d228679960eb94336b49 Mon Sep 17 00:00:00 2001 From: Xin Yao Date: Sat, 6 Feb 2021 09:56:32 -0800 Subject: [PATCH] Support image on local device storage without uploading --- lib/widgets/editor.dart | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/widgets/editor.dart b/lib/widgets/editor.dart index 9d962d29..75ee0e52 100644 --- a/lib/widgets/editor.dart +++ b/lib/widgets/editor.dart @@ -83,7 +83,10 @@ Widget _defaultEmbedBuilder(BuildContext context, Embed node) { color: Colors.grey.shade200, ); case 'image': - return Image.network(node.value.data); + String imageUrl = node.value.data; + return imageUrl.startsWith('http') + ? Image.network(imageUrl) + : Image.asset(imageUrl); default: throw UnimplementedError( 'Embeddable type "${node.value.type}" is not supported by default embed '