From 92a0579489ea79e94ea8275d19eab45d43cc10e2 Mon Sep 17 00:00:00 2001 From: singerdmx Date: Wed, 23 Dec 2020 21:35:28 -0800 Subject: [PATCH] Support image tap to go to photo view --- lib/widgets/editor.dart | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/widgets/editor.dart b/lib/widgets/editor.dart index 0be9bf4b..30c9df6e 100644 --- a/lib/widgets/editor.dart +++ b/lib/widgets/editor.dart @@ -10,6 +10,7 @@ import 'package:flutter_quill/models/documents/attribute.dart'; import 'package:flutter_quill/models/documents/document.dart'; import 'package:flutter_quill/models/documents/nodes/container.dart' as containerNode; +import 'package:flutter_quill/models/documents/nodes/embed.dart'; import 'package:flutter_quill/models/documents/nodes/leaf.dart'; import 'package:flutter_quill/models/documents/nodes/line.dart'; import 'package:flutter_quill/models/documents/nodes/node.dart'; @@ -332,6 +333,18 @@ class _QuillEditorSelectionGestureDetectorBuilder launchUrl(link); } } + if (getEditor().widget.readOnly && segment.value is BlockEmbed) { + BlockEmbed blockEmbed = segment.value as BlockEmbed; + if (blockEmbed.type == 'image') { + Navigator.push( + getEditor().context, + MaterialPageRoute( + builder: (context) => + ImageTapWrapper(imageProvider: NetworkImage(blockEmbed.data)), + ), + ); + } + } } void _launchUrl(String url) async {