From 9340139877243ea7f3fb24f2dfb59f8cd5a7f63e Mon Sep 17 00:00:00 2001 From: Ahmad Nashihuddien Date: Tue, 23 Jan 2024 16:57:18 +0700 Subject: [PATCH 1/3] Update version --- pubspec.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pubspec.yaml b/pubspec.yaml index c96fe0b..e891e6e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,9 +1,9 @@ name: imageview360 description: A Flutter package which provides 360 view of the images with rotation and gesture customisations. -version: 1.2.0 +version: 1.3.1 homepage: https://github.com/hd-motion/flutter_imageview_360 environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.12.0 <4.0.0' dependencies: flutter: From d94e5d61df01fdd05d97b9156a086e681daf3123 Mon Sep 17 00:00:00 2001 From: Ahmad Nashihuddien Date: Tue, 23 Jan 2024 16:59:21 +0700 Subject: [PATCH 2/3] add callback when horizontal drag ends --- lib/imageview360.dart | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/imageview360.dart b/lib/imageview360.dart index 2637e85..f13bac1 100644 --- a/lib/imageview360.dart +++ b/lib/imageview360.dart @@ -32,6 +32,8 @@ class ImageView360 extends StatefulWidget { // Callback function to provide you the index of current image when image frame is changed. final Function(int? currentImageIndex)? onImageIndexChanged; + final void Function()? onDragEnd; + ImageView360({ required Key key, required this.imageList, @@ -39,6 +41,7 @@ class ImageView360 extends StatefulWidget { this.allowSwipeToRotate = true, this.rotationCount = 1, this.swipeSensitivity = 1, + this.onDragEnd, this.rotationDirection = RotationDirection.clockwise, this.frameChangeDuration = const Duration(milliseconds: 80), this.onImageIndexChanged, @@ -82,6 +85,7 @@ class _ImageView360State extends State { GestureDetector( onHorizontalDragEnd: (details) { localPosition = 0.0; + widget.onDragEnd?.call(); }, onHorizontalDragUpdate: (details) { // Swipe check,if allowed than only will image move From b947dac170c5f087721e173f36fed86610d7a0f1 Mon Sep 17 00:00:00 2001 From: Ahmad Nashihuddien Date: Tue, 23 Jan 2024 17:03:33 +0700 Subject: [PATCH 3/3] add callback when horizontal drag start --- lib/imageview360.dart | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/imageview360.dart b/lib/imageview360.dart index f13bac1..782dcbc 100644 --- a/lib/imageview360.dart +++ b/lib/imageview360.dart @@ -32,6 +32,7 @@ class ImageView360 extends StatefulWidget { // Callback function to provide you the index of current image when image frame is changed. final Function(int? currentImageIndex)? onImageIndexChanged; + final void Function()? onDragStart; final void Function()? onDragEnd; ImageView360({ @@ -42,6 +43,7 @@ class ImageView360 extends StatefulWidget { this.rotationCount = 1, this.swipeSensitivity = 1, this.onDragEnd, + this.onDragStart, this.rotationDirection = RotationDirection.clockwise, this.frameChangeDuration = const Duration(milliseconds: 80), this.onImageIndexChanged, @@ -87,6 +89,9 @@ class _ImageView360State extends State { localPosition = 0.0; widget.onDragEnd?.call(); }, + onHorizontalDragDown: (details) { + widget.onDragStart?.call(); + }, onHorizontalDragUpdate: (details) { // Swipe check,if allowed than only will image move if (widget.allowSwipeToRotate) {