TF-4064 Support drag & drop email addresses in composer on mobile
This commit is contained in:
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user