From 782c6f7f44e2137b30361c61ae12b5491827f953 Mon Sep 17 00:00:00 2001 From: Dat Vu Date: Mon, 8 Sep 2025 15:45:10 +0700 Subject: [PATCH] TF-3989 Open email modal with a simple click on Mobile and Web (#3991) --- .../widget/card_with_smart_interaction_overlay_view.dart | 1 + lib/features/base/widget/smart_interaction_widget.dart | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/lib/features/base/widget/card_with_smart_interaction_overlay_view.dart b/lib/features/base/widget/card_with_smart_interaction_overlay_view.dart index ac6bb6d7a..d6f1e95cc 100644 --- a/lib/features/base/widget/card_with_smart_interaction_overlay_view.dart +++ b/lib/features/base/widget/card_with_smart_interaction_overlay_view.dart @@ -112,6 +112,7 @@ class _CardWithSmartInteractionOverlayViewState onRightMouseClickAction: ({RelativeRect? position}) => _togglePopup(), onDoubleClickAction: ({RelativeRect? position}) => _togglePopup(), onLongPressAction: _togglePopup, + onTapAction: _togglePopup, child: widget.child, ), ); diff --git a/lib/features/base/widget/smart_interaction_widget.dart b/lib/features/base/widget/smart_interaction_widget.dart index 97d2b83c4..707d1b539 100644 --- a/lib/features/base/widget/smart_interaction_widget.dart +++ b/lib/features/base/widget/smart_interaction_widget.dart @@ -8,6 +8,7 @@ import 'package:universal_html/html.dart' as html; typedef OnRightMouseClickAction = void Function({RelativeRect? position}); typedef OnDoubleClickAction = void Function({RelativeRect? position}); typedef OnLongPressAction = void Function(); +typedef OnTapAction = void Function(); class SmartInteractionWidget extends StatefulWidget { final Widget child; @@ -15,6 +16,7 @@ class SmartInteractionWidget extends StatefulWidget { final OnRightMouseClickAction onRightMouseClickAction; final OnDoubleClickAction onDoubleClickAction; final OnLongPressAction onLongPressAction; + final OnTapAction onTapAction; const SmartInteractionWidget({ super.key, @@ -22,6 +24,7 @@ class SmartInteractionWidget extends StatefulWidget { required this.onRightMouseClickAction, required this.onDoubleClickAction, required this.onLongPressAction, + required this.onTapAction, this.usePosition = false, }); @@ -132,6 +135,8 @@ class _SmartInteractionWidgetState extends State { void _handleLongPress() => widget.onLongPressAction(); + void _handleOnTapAction() => widget.onTapAction(); + @override Widget build(BuildContext context) { if (PlatformInfo.isWeb) { @@ -146,6 +151,7 @@ class _SmartInteractionWidgetState extends State { }, child: GestureDetector( onDoubleTap: _handleDoubleTap, + onTap: _handleOnTapAction, child: widget.child, ), ); @@ -154,12 +160,14 @@ class _SmartInteractionWidgetState extends State { key: _childKey, behavior: HitTestBehavior.opaque, onDoubleTap: _handleDoubleTap, + onTap: _handleOnTapAction, child: widget.child, ); } } else { return GestureDetector( onLongPress: _handleLongPress, + onTap: _handleOnTapAction, child: widget.child, ); }