Skip to content

Commit 69e5662

Browse files
committed
TF-4064 Support drag & drop email addresses in composer on mobile
1 parent 620d155 commit 69e5662

File tree

3 files changed

+27
-21
lines changed

3 files changed

+27
-21
lines changed

lib/features/base/widget/card_with_smart_interaction_overlay_view.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ class _CardWithSmartInteractionOverlayViewState
111111
child: SmartInteractionWidget(
112112
onRightMouseClickAction: ({RelativeRect? position}) => _togglePopup(),
113113
onDoubleClickAction: ({RelativeRect? position}) => _togglePopup(),
114-
onLongPressAction: _togglePopup,
115114
onTapAction: _togglePopup,
116115
child: widget.child,
117116
),

lib/features/base/widget/smart_interaction_widget.dart

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,20 @@ import 'package:universal_html/html.dart' as html;
77

88
typedef OnRightMouseClickAction = void Function({RelativeRect? position});
99
typedef OnDoubleClickAction = void Function({RelativeRect? position});
10-
typedef OnLongPressAction = void Function();
1110
typedef OnTapAction = void Function();
1211

1312
class SmartInteractionWidget extends StatefulWidget {
1413
final Widget child;
1514
final bool usePosition;
1615
final OnRightMouseClickAction onRightMouseClickAction;
1716
final OnDoubleClickAction onDoubleClickAction;
18-
final OnLongPressAction onLongPressAction;
1917
final OnTapAction onTapAction;
2018

2119
const SmartInteractionWidget({
2220
super.key,
2321
required this.child,
2422
required this.onRightMouseClickAction,
2523
required this.onDoubleClickAction,
26-
required this.onLongPressAction,
2724
required this.onTapAction,
2825
this.usePosition = false,
2926
});
@@ -133,8 +130,6 @@ class _SmartInteractionWidgetState extends State<SmartInteractionWidget> {
133130
}
134131
}
135132

136-
void _handleLongPress() => widget.onLongPressAction();
137-
138133
void _handleOnTapAction() => widget.onTapAction();
139134

140135
@override
@@ -172,7 +167,6 @@ class _SmartInteractionWidgetState extends State<SmartInteractionWidget> {
172167
}
173168
} else {
174169
return GestureDetector(
175-
onLongPress: _handleLongPress,
176170
onTap: _handleOnTapAction,
177171
child: widget.child,
178172
);

lib/features/composer/presentation/widgets/recipient_tag_item_widget.dart

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -139,24 +139,37 @@ class RecipientTagItemWidget extends StatelessWidget {
139139
);
140140

141141
if (PlatformInfo.isWeb || isTestingForWeb) {
142-
tagWidget = Draggable<DraggableEmailAddress>(
143-
data: DraggableEmailAddress(
144-
emailAddress: currentEmailAddress,
145-
filterField: prefix.filterField,
146-
composerId: composerId,
147-
),
148-
feedback: DraggableRecipientTagWidget(
149-
imagePaths: imagePaths,
150-
emailAddress: currentEmailAddress,
151-
),
152-
childWhenDragging: DraggableRecipientTagWidget(
153-
imagePaths: imagePaths,
154-
emailAddress: currentEmailAddress,
155-
),
142+
tagWidget = MouseRegion(
143+
cursor: SystemMouseCursors.grab,
156144
child: tagWidget,
157145
);
158146
}
159147

148+
tagWidget = Draggable<DraggableEmailAddress>(
149+
data: DraggableEmailAddress(
150+
emailAddress: currentEmailAddress,
151+
filterField: prefix.filterField,
152+
composerId: composerId,
153+
),
154+
feedback: DraggableRecipientTagWidget(
155+
imagePaths: imagePaths,
156+
emailAddress: currentEmailAddress,
157+
),
158+
childWhenDragging: PlatformInfo.isMobile
159+
? Padding(
160+
padding: const EdgeInsets.only(top: 10),
161+
child: DraggableRecipientTagWidget(
162+
imagePaths: imagePaths,
163+
emailAddress: currentEmailAddress,
164+
),
165+
)
166+
: DraggableRecipientTagWidget(
167+
imagePaths: imagePaths,
168+
emailAddress: currentEmailAddress,
169+
),
170+
child: tagWidget,
171+
);
172+
160173
if ((PlatformInfo.isWeb || isTestingForWeb) && PlatformInfo.isCanvasKit) {
161174
tagWidget = Padding(
162175
padding: const EdgeInsetsDirectional.only(top: 8),

0 commit comments

Comments
 (0)