TF-4233 Handle edit label on mobile
This commit is contained in:
@@ -426,12 +426,18 @@ abstract class BaseMailboxView extends GetWidget<MailboxController>
|
||||
PresentationLabelMailbox.initial(label),
|
||||
),
|
||||
onOpenContextMenu: (label, position) =>
|
||||
dashboardController.openLabelContextMenuAction(
|
||||
dashboardController.openLabelPopupMenuAction(
|
||||
context,
|
||||
controller.imagePaths,
|
||||
label,
|
||||
position,
|
||||
),
|
||||
onLongPressLabelItemAction: (label) =>
|
||||
dashboardController.openLabelContextMenuAction(
|
||||
context,
|
||||
controller.imagePaths,
|
||||
label,
|
||||
),
|
||||
)
|
||||
: const Offstage(),
|
||||
);
|
||||
|
||||
+16
-3
@@ -7,7 +7,7 @@ import 'package:tmail_ui_user/features/labels/presentation/models/label_action_t
|
||||
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/controller/mailbox_dashboard_controller.dart';
|
||||
|
||||
extension HandleLabelActionTypeExtension on MailboxDashBoardController {
|
||||
Future<void> openLabelContextMenuAction(
|
||||
Future<void> openLabelPopupMenuAction(
|
||||
BuildContext context,
|
||||
ImagePaths imagePaths,
|
||||
Label label,
|
||||
@@ -17,11 +17,11 @@ extension HandleLabelActionTypeExtension on MailboxDashBoardController {
|
||||
isPopupMenuOpened.value = true;
|
||||
}
|
||||
return labelController
|
||||
.openLabelContextMenuAction(
|
||||
.openLabelMenuAction(
|
||||
context,
|
||||
imagePaths,
|
||||
label,
|
||||
position,
|
||||
position: position,
|
||||
_onPerformLabelActionType,
|
||||
)
|
||||
.whenComplete(() {
|
||||
@@ -38,4 +38,17 @@ extension HandleLabelActionTypeExtension on MailboxDashBoardController {
|
||||
label: label,
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> openLabelContextMenuAction(
|
||||
BuildContext context,
|
||||
ImagePaths imagePaths,
|
||||
Label label,
|
||||
) async {
|
||||
return labelController.openLabelMenuAction(
|
||||
context,
|
||||
imagePaths,
|
||||
label,
|
||||
_onPerformLabelActionType,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@ import 'package:flutter/material.dart';
|
||||
import 'package:labels/labels.dart';
|
||||
import 'package:tmail_ui_user/features/labels/presentation/models/label_action_type.dart';
|
||||
|
||||
typedef OnOpenLabelCallback = void Function(Label label);
|
||||
|
||||
typedef OnOpenLabelContextMenuAction = Future<void> Function(
|
||||
Label label,
|
||||
RelativeRect position,
|
||||
@@ -11,3 +13,5 @@ typedef OnLabelActionTypeCallback = void Function(
|
||||
Label label,
|
||||
LabelActionType actionType,
|
||||
);
|
||||
|
||||
typedef OnLongPressLabelItemAction = void Function(Label label);
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'package:core/presentation/extensions/color_extension.dart';
|
||||
import 'package:core/presentation/resources/image_paths.dart';
|
||||
import 'package:core/presentation/views/button/tmail_button_widget.dart';
|
||||
import 'package:core/utils/platform_info.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:labels/extensions/label_extension.dart';
|
||||
import 'package:labels/model/label.dart';
|
||||
@@ -10,8 +11,6 @@ import 'package:tmail_ui_user/features/mailbox/presentation/utils/labels/label_m
|
||||
import 'package:tmail_ui_user/features/mailbox/presentation/widgets/labels/label_icon_widget.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox/presentation/widgets/labels/label_name_widget.dart';
|
||||
|
||||
typedef OnOpenLabelCallback = void Function(Label label);
|
||||
|
||||
class LabelListItem extends StatefulWidget {
|
||||
final Label label;
|
||||
final ImagePaths imagePaths;
|
||||
@@ -20,6 +19,7 @@ class LabelListItem extends StatefulWidget {
|
||||
final bool isMobileResponsive;
|
||||
final OnOpenLabelCallback onOpenLabelCallback;
|
||||
final OnOpenLabelContextMenuAction? onOpenContextMenu;
|
||||
final OnLongPressLabelItemAction? onLongPressLabelItemAction;
|
||||
|
||||
const LabelListItem({
|
||||
super.key,
|
||||
@@ -30,6 +30,7 @@ class LabelListItem extends StatefulWidget {
|
||||
this.isSelected = false,
|
||||
this.isMobileResponsive = false,
|
||||
this.onOpenContextMenu,
|
||||
this.onLongPressLabelItemAction,
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -84,6 +85,9 @@ class _LabelListItemState extends State<LabelListItem> {
|
||||
borderRadius: _borderRadius,
|
||||
onHover: _handleHoverChanged,
|
||||
onTap: () => widget.onOpenLabelCallback(widget.label),
|
||||
onLongPress: PlatformInfo.isWebTouchDevice || PlatformInfo.isMobile
|
||||
? () => widget.onLongPressLabelItemAction?.call(widget.label)
|
||||
: null,
|
||||
child: Container(
|
||||
height: _itemHeight,
|
||||
padding: _itemPadding,
|
||||
|
||||
@@ -13,6 +13,7 @@ class LabelListView extends StatelessWidget {
|
||||
final OnOpenLabelCallback onOpenLabelCallback;
|
||||
final bool isMobileResponsive;
|
||||
final OnOpenLabelContextMenuAction? onOpenContextMenu;
|
||||
final OnLongPressLabelItemAction? onLongPressLabelItemAction;
|
||||
|
||||
const LabelListView({
|
||||
super.key,
|
||||
@@ -23,6 +24,7 @@ class LabelListView extends StatelessWidget {
|
||||
this.labelIdSelected,
|
||||
this.isMobileResponsive = false,
|
||||
this.onOpenContextMenu,
|
||||
this.onLongPressLabelItemAction,
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -43,6 +45,7 @@ class LabelListView extends StatelessWidget {
|
||||
onOpenLabelCallback: onOpenLabelCallback,
|
||||
isMobileResponsive: isMobileResponsive,
|
||||
onOpenContextMenu: onOpenContextMenu,
|
||||
onLongPressLabelItemAction: onLongPressLabelItemAction,
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user