TF-3989 Open email modal with a simple click on Mobile and Web (#3991)

This commit is contained in:
Dat Vu
2025-09-08 15:45:10 +07:00
committed by GitHub
parent 2ca0f12b55
commit 782c6f7f44
2 changed files with 9 additions and 0 deletions
@@ -112,6 +112,7 @@ class _CardWithSmartInteractionOverlayViewState
onRightMouseClickAction: ({RelativeRect? position}) => _togglePopup(), onRightMouseClickAction: ({RelativeRect? position}) => _togglePopup(),
onDoubleClickAction: ({RelativeRect? position}) => _togglePopup(), onDoubleClickAction: ({RelativeRect? position}) => _togglePopup(),
onLongPressAction: _togglePopup, onLongPressAction: _togglePopup,
onTapAction: _togglePopup,
child: widget.child, child: widget.child,
), ),
); );
@@ -8,6 +8,7 @@ import 'package:universal_html/html.dart' as html;
typedef OnRightMouseClickAction = void Function({RelativeRect? position}); typedef OnRightMouseClickAction = void Function({RelativeRect? position});
typedef OnDoubleClickAction = void Function({RelativeRect? position}); typedef OnDoubleClickAction = void Function({RelativeRect? position});
typedef OnLongPressAction = void Function(); typedef OnLongPressAction = void Function();
typedef OnTapAction = void Function();
class SmartInteractionWidget extends StatefulWidget { class SmartInteractionWidget extends StatefulWidget {
final Widget child; final Widget child;
@@ -15,6 +16,7 @@ class SmartInteractionWidget extends StatefulWidget {
final OnRightMouseClickAction onRightMouseClickAction; final OnRightMouseClickAction onRightMouseClickAction;
final OnDoubleClickAction onDoubleClickAction; final OnDoubleClickAction onDoubleClickAction;
final OnLongPressAction onLongPressAction; final OnLongPressAction onLongPressAction;
final OnTapAction onTapAction;
const SmartInteractionWidget({ const SmartInteractionWidget({
super.key, super.key,
@@ -22,6 +24,7 @@ class SmartInteractionWidget extends StatefulWidget {
required this.onRightMouseClickAction, required this.onRightMouseClickAction,
required this.onDoubleClickAction, required this.onDoubleClickAction,
required this.onLongPressAction, required this.onLongPressAction,
required this.onTapAction,
this.usePosition = false, this.usePosition = false,
}); });
@@ -132,6 +135,8 @@ class _SmartInteractionWidgetState extends State<SmartInteractionWidget> {
void _handleLongPress() => widget.onLongPressAction(); void _handleLongPress() => widget.onLongPressAction();
void _handleOnTapAction() => widget.onTapAction();
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
if (PlatformInfo.isWeb) { if (PlatformInfo.isWeb) {
@@ -146,6 +151,7 @@ class _SmartInteractionWidgetState extends State<SmartInteractionWidget> {
}, },
child: GestureDetector( child: GestureDetector(
onDoubleTap: _handleDoubleTap, onDoubleTap: _handleDoubleTap,
onTap: _handleOnTapAction,
child: widget.child, child: widget.child,
), ),
); );
@@ -154,12 +160,14 @@ class _SmartInteractionWidgetState extends State<SmartInteractionWidget> {
key: _childKey, key: _childKey,
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
onDoubleTap: _handleDoubleTap, onDoubleTap: _handleDoubleTap,
onTap: _handleOnTapAction,
child: widget.child, child: widget.child,
); );
} }
} else { } else {
return GestureDetector( return GestureDetector(
onLongPress: _handleLongPress, onLongPress: _handleLongPress,
onTap: _handleOnTapAction,
child: widget.child, child: widget.child,
); );
} }