[extensions] Add the image source to to onImageClicked (#1653)

Allow onImageClicked for the image embed builder
pull/1657/head
Tim Anthony Manuel 1 year ago committed by GitHub
parent 4f5092495e
commit eb540cc038
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      flutter_quill_extensions/lib/embeds/image/editor/image_embed.dart
  2. 6
      flutter_quill_extensions/lib/models/config/editor/image/image.dart

@ -56,8 +56,9 @@ class QuillEditorImageEmbedBuilder extends EmbedBuilder {
QuillSharedExtensionsConfigurations.get(context: context)
.imageSaverService;
return GestureDetector(
onTap: configurations.onImageClicked ??
() => showDialog(
onTap: configurations.onImageClicked != null
? () => configurations.onImageClicked!(imageSource)
: () => showDialog(
context: context,
builder: (_) => FlutterQuillLocalizationsWidget(
child: ImageOptionsMenu(

@ -1,6 +1,5 @@
import 'dart:io' show File;
import 'package:flutter/foundation.dart' show VoidCallback;
import 'package:flutter_quill/extensions.dart';
import 'package:meta/meta.dart' show immutable;
@ -103,8 +102,9 @@ class QuillEditorImageEmbedConfigurations {
/// What should happen when the image is pressed?
///
/// By default will show `ImageOptionsMenu` dialog
final VoidCallback? onImageClicked;
/// By default will show `ImageOptionsMenu` dialog. If you want to handle what happens
/// to the image when it's clicked, you can pass a callback to this property.
final void Function(String imageSource)? onImageClicked;
static ImageEmbedBuilderOnRemovedCallback get defaultOnImageRemovedCallback {
return (imageUrl) async {

Loading…
Cancel
Save