TF-4064 Support drag & drop email addresses in composer on mobile
This commit is contained in:
@@ -111,7 +111,6 @@ class _CardWithSmartInteractionOverlayViewState
|
|||||||
child: SmartInteractionWidget(
|
child: SmartInteractionWidget(
|
||||||
onRightMouseClickAction: ({RelativeRect? position}) => _togglePopup(),
|
onRightMouseClickAction: ({RelativeRect? position}) => _togglePopup(),
|
||||||
onDoubleClickAction: ({RelativeRect? position}) => _togglePopup(),
|
onDoubleClickAction: ({RelativeRect? position}) => _togglePopup(),
|
||||||
onLongPressAction: _togglePopup,
|
|
||||||
onTapAction: _togglePopup,
|
onTapAction: _togglePopup,
|
||||||
child: widget.child,
|
child: widget.child,
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ 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 OnTapAction = void Function();
|
typedef OnTapAction = void Function();
|
||||||
|
|
||||||
class SmartInteractionWidget extends StatefulWidget {
|
class SmartInteractionWidget extends StatefulWidget {
|
||||||
@@ -15,7 +14,6 @@ class SmartInteractionWidget extends StatefulWidget {
|
|||||||
final bool usePosition;
|
final bool usePosition;
|
||||||
final OnRightMouseClickAction onRightMouseClickAction;
|
final OnRightMouseClickAction onRightMouseClickAction;
|
||||||
final OnDoubleClickAction onDoubleClickAction;
|
final OnDoubleClickAction onDoubleClickAction;
|
||||||
final OnLongPressAction onLongPressAction;
|
|
||||||
final OnTapAction onTapAction;
|
final OnTapAction onTapAction;
|
||||||
|
|
||||||
const SmartInteractionWidget({
|
const SmartInteractionWidget({
|
||||||
@@ -23,7 +21,6 @@ class SmartInteractionWidget extends StatefulWidget {
|
|||||||
required this.child,
|
required this.child,
|
||||||
required this.onRightMouseClickAction,
|
required this.onRightMouseClickAction,
|
||||||
required this.onDoubleClickAction,
|
required this.onDoubleClickAction,
|
||||||
required this.onLongPressAction,
|
|
||||||
required this.onTapAction,
|
required this.onTapAction,
|
||||||
this.usePosition = false,
|
this.usePosition = false,
|
||||||
});
|
});
|
||||||
@@ -133,8 +130,6 @@ class _SmartInteractionWidgetState extends State<SmartInteractionWidget> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _handleLongPress() => widget.onLongPressAction();
|
|
||||||
|
|
||||||
void _handleOnTapAction() => widget.onTapAction();
|
void _handleOnTapAction() => widget.onTapAction();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -172,7 +167,6 @@ class _SmartInteractionWidgetState extends State<SmartInteractionWidget> {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onLongPress: _handleLongPress,
|
|
||||||
onTap: _handleOnTapAction,
|
onTap: _handleOnTapAction,
|
||||||
child: widget.child,
|
child: widget.child,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -139,24 +139,37 @@ class RecipientTagItemWidget extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (PlatformInfo.isWeb || isTestingForWeb) {
|
if (PlatformInfo.isWeb || isTestingForWeb) {
|
||||||
tagWidget = Draggable<DraggableEmailAddress>(
|
tagWidget = MouseRegion(
|
||||||
data: DraggableEmailAddress(
|
cursor: SystemMouseCursors.grab,
|
||||||
emailAddress: currentEmailAddress,
|
|
||||||
filterField: prefix.filterField,
|
|
||||||
composerId: composerId,
|
|
||||||
),
|
|
||||||
feedback: DraggableRecipientTagWidget(
|
|
||||||
imagePaths: imagePaths,
|
|
||||||
emailAddress: currentEmailAddress,
|
|
||||||
),
|
|
||||||
childWhenDragging: DraggableRecipientTagWidget(
|
|
||||||
imagePaths: imagePaths,
|
|
||||||
emailAddress: currentEmailAddress,
|
|
||||||
),
|
|
||||||
child: tagWidget,
|
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) {
|
if ((PlatformInfo.isWeb || isTestingForWeb) && PlatformInfo.isCanvasKit) {
|
||||||
tagWidget = Padding(
|
tagWidget = Padding(
|
||||||
padding: const EdgeInsetsDirectional.only(top: 8),
|
padding: const EdgeInsetsDirectional.only(top: 8),
|
||||||
|
|||||||
Reference in New Issue
Block a user