From 3e86f5dfec49db87541330ad8ca915dd15ec0198 Mon Sep 17 00:00:00 2001 From: HuyNguyen Date: Thu, 25 May 2023 01:37:47 +0700 Subject: [PATCH] TF-1862: Fix show widget of Draggable when click right on email (cherry picked from commit ff75ab1faa9d01f92b6740f057b17020c0c5b32b) --- .../thread/presentation/thread_view.dart | 29 ++++++++++++------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/lib/features/thread/presentation/thread_view.dart b/lib/features/thread/presentation/thread_view.dart index e86f14fb4..00c48b15f 100644 --- a/lib/features/thread/presentation/thread_view.dart +++ b/lib/features/thread/presentation/thread_view.dart @@ -358,18 +358,25 @@ class ThreadView extends GetWidget } Widget _buildEmailItemDraggable(BuildContext context, PresentationEmail presentationEmail) { - return Draggable>( - data: controller.listEmailDrag, - feedback: _buildFeedBackWidget(context), - childWhenDragging: _buildEmailItemWhenDragging(context, presentationEmail), - dragAnchorStrategy: pointerDragAnchorStrategy, - onDragStarted: () { - controller.calculateDragValue(presentationEmail); - controller.onDragMailBox(true); + return GestureDetector( + behavior: HitTestBehavior.translucent, + onSecondaryTapDown: (details) { + // 1. Use empty callback to disable D&D on mouse right button + // 2. Call `showMenu` to show context menu }, - onDragEnd: (_) => controller.onDragMailBox(false), - onDraggableCanceled: (_,__) => controller.onDragMailBox(false), - child: _buildEmailItemNotDraggable(context, presentationEmail) + child: Draggable>( + data: controller.listEmailDrag, + feedback: _buildFeedBackWidget(context), + childWhenDragging: _buildEmailItemWhenDragging(context, presentationEmail), + dragAnchorStrategy: pointerDragAnchorStrategy, + onDragStarted: () { + controller.calculateDragValue(presentationEmail); + controller.onDragMailBox(true); + }, + onDragEnd: (_) => controller.onDragMailBox(false), + onDraggableCanceled: (_,__) => controller.onDragMailBox(false), + child: _buildEmailItemNotDraggable(context, presentationEmail) + ), ); }