From 69c73bbc1b2fe5610d9bb775832112542c301014 Mon Sep 17 00:00:00 2001 From: Francesco Paolo Date: Sat, 6 Jan 2024 15:10:28 +0100 Subject: [PATCH 1/4] Update galleryimage.dart Add on Image Long Press Callback to manipulate image outside --- lib/galleryimage.dart | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/galleryimage.dart b/lib/galleryimage.dart index 7c8c3c2..409894d 100644 --- a/lib/galleryimage.dart +++ b/lib/galleryimage.dart @@ -29,7 +29,8 @@ class GalleryImage extends StatefulWidget { final bool showAppBar; final bool closeWhenSwipeUp; final bool closeWhenSwipeDown; - + final void Function(String)? onImagePress; + const GalleryImage({ Key? key, required this.imageUrls, @@ -53,6 +54,7 @@ class GalleryImage extends StatefulWidget { this.showAppBar = true, this.closeWhenSwipeUp = false, this.closeWhenSwipeDown = false, + this.onImagePress, }) : assert(numOfShowImages <= imageUrls.length), super(key: key); @override @@ -102,6 +104,9 @@ class _GalleryImageState extends State { // build image with number for other images Widget _buildImageNumbers(int index) { return GestureDetector( + onLongPress: () { + widget.onImagePress?.call(index); + }, onTap: () { _openImageFullScreen(index); }, From 125273cb056eab5fd65811820d475e9b0e27f56c Mon Sep 17 00:00:00 2001 From: Francesco Paolo Date: Sat, 6 Jan 2024 15:59:02 +0100 Subject: [PATCH 2/4] Update galleryimage.dart --- lib/galleryimage.dart | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/galleryimage.dart b/lib/galleryimage.dart index 409894d..35a7fe9 100644 --- a/lib/galleryimage.dart +++ b/lib/galleryimage.dart @@ -29,7 +29,7 @@ class GalleryImage extends StatefulWidget { final bool showAppBar; final bool closeWhenSwipeUp; final bool closeWhenSwipeDown; - final void Function(String)? onImagePress; + final void Function(int)? onImagePress; const GalleryImage({ Key? key, @@ -91,6 +91,9 @@ class _GalleryImageState extends State { ? _buildImageNumbers(index) : GalleryItemThumbnail( galleryItem: galleryItems[index], + onLongPress: () { + widget.onImagePress?.call(index); + }, onTap: () { _openImageFullScreen(index); }, @@ -119,6 +122,7 @@ class _GalleryImageState extends State { loadingWidget: widget.loadingWidget, errorWidget: widget.errorWidget, onTap: null, + onLongPress: null, radius: widget.imageRadius, ), ClipRRect( From 5831d1c7deef25728520958e90e6eaa0bacc6594 Mon Sep 17 00:00:00 2001 From: Francesco Paolo Date: Sat, 6 Jan 2024 15:59:17 +0100 Subject: [PATCH 3/4] Update gallery_item_thumbnail.dart --- lib/gallery_item_thumbnail.dart | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/gallery_item_thumbnail.dart b/lib/gallery_item_thumbnail.dart index 4013367..95aee47 100644 --- a/lib/gallery_item_thumbnail.dart +++ b/lib/gallery_item_thumbnail.dart @@ -6,6 +6,7 @@ import 'gallery_item_model.dart'; // to show image in Row class GalleryItemThumbnail extends StatelessWidget { final GalleryItemModel galleryItem; + final GestureTapCallback? onLongPress; final GestureTapCallback? onTap; final Widget? loadingWidget; final Widget? errorWidget; @@ -14,6 +15,7 @@ class GalleryItemThumbnail extends StatelessWidget { const GalleryItemThumbnail( {Key? key, required this.galleryItem, + required this.onLongPress, required this.onTap, required this.radius, required this.loadingWidget, @@ -23,6 +25,7 @@ class GalleryItemThumbnail extends StatelessWidget { @override Widget build(BuildContext context) { return GestureDetector( + onLongPress: onLongPress, onTap: onTap, child: Hero( tag: galleryItem.id, From fa03447068b8a98d69c161762a837003b087c081 Mon Sep 17 00:00:00 2001 From: Francesco Paolo Date: Sat, 6 Jan 2024 15:59:35 +0100 Subject: [PATCH 4/4] Update pubspec.yaml --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 8140153..6cb090a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: galleryimage description: Flutter plugin that list of images from URLs allows you to display and zoomable multi image on iOS and Android. -version: 2.0.1 +version: 2.0.2 homepage: https://github.com/BeshoyMelika/flutter-gallery-package environment: