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(),
onDoubleClickAction: ({RelativeRect? position}) => _togglePopup(),
onLongPressAction: _togglePopup,
onTapAction: _togglePopup,
child: widget.child,
),
);
@@ -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<SmartInteractionWidget> {
void _handleLongPress() => widget.onLongPressAction();
void _handleOnTapAction() => widget.onTapAction();
@override
Widget build(BuildContext context) {
if (PlatformInfo.isWeb) {
@@ -146,6 +151,7 @@ class _SmartInteractionWidgetState extends State<SmartInteractionWidget> {
},
child: GestureDetector(
onDoubleTap: _handleDoubleTap,
onTap: _handleOnTapAction,
child: widget.child,
),
);
@@ -154,12 +160,14 @@ class _SmartInteractionWidgetState extends State<SmartInteractionWidget> {
key: _childKey,
behavior: HitTestBehavior.opaque,
onDoubleTap: _handleDoubleTap,
onTap: _handleOnTapAction,
child: widget.child,
);
}
} else {
return GestureDetector(
onLongPress: _handleLongPress,
onTap: _handleOnTapAction,
child: widget.child,
);
}