TF-4064 Support drag & drop email addresses in composer on mobile

This commit is contained in:
dab246
2025-09-26 15:44:19 +07:00
committed by Dat H. Pham
parent 6a78d57619
commit 433616a9c2
3 changed files with 27 additions and 21 deletions
@@ -111,7 +111,6 @@ class _CardWithSmartInteractionOverlayViewState
child: SmartInteractionWidget(
onRightMouseClickAction: ({RelativeRect? position}) => _togglePopup(),
onDoubleClickAction: ({RelativeRect? position}) => _togglePopup(),
onLongPressAction: _togglePopup,
onTapAction: _togglePopup,
child: widget.child,
),
@@ -7,7 +7,6 @@ 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 {
@@ -15,7 +14,6 @@ class SmartInteractionWidget extends StatefulWidget {
final bool usePosition;
final OnRightMouseClickAction onRightMouseClickAction;
final OnDoubleClickAction onDoubleClickAction;
final OnLongPressAction onLongPressAction;
final OnTapAction onTapAction;
const SmartInteractionWidget({
@@ -23,7 +21,6 @@ class SmartInteractionWidget extends StatefulWidget {
required this.child,
required this.onRightMouseClickAction,
required this.onDoubleClickAction,
required this.onLongPressAction,
required this.onTapAction,
this.usePosition = false,
});
@@ -133,8 +130,6 @@ class _SmartInteractionWidgetState extends State<SmartInteractionWidget> {
}
}
void _handleLongPress() => widget.onLongPressAction();
void _handleOnTapAction() => widget.onTapAction();
@override
@@ -172,7 +167,6 @@ class _SmartInteractionWidgetState extends State<SmartInteractionWidget> {
}
} else {
return GestureDetector(
onLongPress: _handleLongPress,
onTap: _handleOnTapAction,
child: widget.child,
);
@@ -139,24 +139,37 @@ class RecipientTagItemWidget extends StatelessWidget {
);
if (PlatformInfo.isWeb || isTestingForWeb) {
tagWidget = Draggable<DraggableEmailAddress>(
data: DraggableEmailAddress(
emailAddress: currentEmailAddress,
filterField: prefix.filterField,
composerId: composerId,
),
feedback: DraggableRecipientTagWidget(
imagePaths: imagePaths,
emailAddress: currentEmailAddress,
),
childWhenDragging: DraggableRecipientTagWidget(
imagePaths: imagePaths,
emailAddress: currentEmailAddress,
),
tagWidget = MouseRegion(
cursor: SystemMouseCursors.grab,
child: tagWidget,
);
}
tagWidget = Draggable<DraggableEmailAddress>(
data: DraggableEmailAddress(
emailAddress: currentEmailAddress,
filterField: prefix.filterField,
composerId: composerId,
),
feedback: DraggableRecipientTagWidget(
imagePaths: imagePaths,
emailAddress: currentEmailAddress,
),
childWhenDragging: PlatformInfo.isMobile
? Padding(
padding: const EdgeInsets.only(top: 10),
child: DraggableRecipientTagWidget(
imagePaths: imagePaths,
emailAddress: currentEmailAddress,
),
)
: DraggableRecipientTagWidget(
imagePaths: imagePaths,
emailAddress: currentEmailAddress,
),
child: tagWidget,
);
if ((PlatformInfo.isWeb || isTestingForWeb) && PlatformInfo.isCanvasKit) {
tagWidget = Padding(
padding: const EdgeInsetsDirectional.only(top: 8),