TF-3759 Display correct context menu for web responsive
Signed-off-by: dab246 <tdvu@linagora.com>
This commit is contained in:
@@ -204,24 +204,18 @@ abstract class BaseMailboxView extends GetWidget<MailboxController>
|
||||
context,
|
||||
mailboxNode.item,
|
||||
),
|
||||
onDragItemAccepted: PlatformInfo.isMobile
|
||||
? null
|
||||
: controller.handleDragItemAccepted,
|
||||
onMenuActionClick: PlatformInfo.isMobile
|
||||
? null
|
||||
: (position, mailboxNode) {
|
||||
return controller.openMailboxContextMenuAction(
|
||||
context,
|
||||
position,
|
||||
mailboxNode.item,
|
||||
);
|
||||
},
|
||||
onEmptyMailboxActionCallback: PlatformInfo.isMobile
|
||||
? null
|
||||
: (mailboxNode) => controller.emptyMailboxAction(
|
||||
context,
|
||||
mailboxNode.item,
|
||||
),
|
||||
onDragItemAccepted: controller.handleDragItemAccepted,
|
||||
onMenuActionClick: (position, mailboxNode) {
|
||||
return controller.openMailboxContextMenuAction(
|
||||
context,
|
||||
position,
|
||||
mailboxNode.item,
|
||||
);
|
||||
},
|
||||
onEmptyMailboxActionCallback: (mailboxNode) => controller.emptyMailboxAction(
|
||||
context,
|
||||
mailboxNode.item,
|
||||
),
|
||||
));
|
||||
|
||||
if (mailboxNode.hasChildren()) {
|
||||
|
||||
@@ -75,53 +75,30 @@ extension HandleMailboxActionExtension on MailboxController {
|
||||
final isSubAddressingSupported =
|
||||
session?.isSubAddressingSupported(accountId) ?? false;
|
||||
|
||||
if (responsiveUtils.isScreenWithShortestSide(context)) {
|
||||
final contextMenuActions = listContextMenuItemAction(
|
||||
mailbox,
|
||||
mailboxDashBoardController.enableSpamReport,
|
||||
deletedMessageVaultSupported,
|
||||
isSubAddressingSupported,
|
||||
imagePaths,
|
||||
AppLocalizations.of(context),
|
||||
);
|
||||
final popupMenuActions = getListPopupMenuItemAction(
|
||||
AppLocalizations.of(context),
|
||||
imagePaths,
|
||||
mailbox,
|
||||
mailboxDashBoardController.enableSpamReport,
|
||||
deletedMessageVaultSupported,
|
||||
isSubAddressingSupported,
|
||||
);
|
||||
|
||||
if (contextMenuActions.isEmpty) return Future.value();
|
||||
if (popupMenuActions.isEmpty) return Future.value();
|
||||
|
||||
return openBottomSheetContextMenuAction(
|
||||
context: context,
|
||||
itemActions: contextMenuActions,
|
||||
onContextMenuActionClick: (menuAction) => handleMailboxAction(
|
||||
context,
|
||||
menuAction.action,
|
||||
mailbox,
|
||||
final popupMenuItems = popupMenuActions.map((menuAction) {
|
||||
return PopupMenuItem(
|
||||
padding: EdgeInsets.zero,
|
||||
child: PopupMenuItemActionWidget(
|
||||
menuAction: menuAction,
|
||||
menuActionClick: (menuAction) {
|
||||
popBack();
|
||||
handleMailboxAction(context, menuAction.action, mailbox);
|
||||
},
|
||||
),
|
||||
);
|
||||
} else {
|
||||
final popupMenuActions = getListPopupMenuItemAction(
|
||||
AppLocalizations.of(context),
|
||||
imagePaths,
|
||||
mailbox,
|
||||
mailboxDashBoardController.enableSpamReport,
|
||||
deletedMessageVaultSupported,
|
||||
isSubAddressingSupported,
|
||||
);
|
||||
}).toList();
|
||||
|
||||
if (popupMenuActions.isEmpty) return Future.value();
|
||||
|
||||
final popupMenuItems = popupMenuActions.map((menuAction) {
|
||||
return PopupMenuItem(
|
||||
padding: EdgeInsets.zero,
|
||||
child: PopupMenuItemActionWidget(
|
||||
menuAction: menuAction,
|
||||
menuActionClick: (menuAction) {
|
||||
popBack();
|
||||
handleMailboxAction(context, menuAction.action, mailbox);
|
||||
},
|
||||
),
|
||||
);
|
||||
}).toList();
|
||||
|
||||
return openPopupMenuAction(context, position, popupMenuItems);
|
||||
}
|
||||
return openPopupMenuAction(context, position, popupMenuItems);
|
||||
}
|
||||
}
|
||||
+4
-10
@@ -1,5 +1,4 @@
|
||||
import 'package:core/presentation/resources/image_paths.dart';
|
||||
import 'package:core/presentation/utils/responsive_utils.dart';
|
||||
import 'package:core/presentation/views/button/tmail_button_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
@@ -39,7 +38,6 @@ class DesktopListEmailActionHoverWidget extends StatefulWidget {
|
||||
class _DesktopListEmailActionHoverWidgetState
|
||||
extends State<DesktopListEmailActionHoverWidget> with BaseEmailItemTile {
|
||||
final _imagePaths = Get.find<ImagePaths>();
|
||||
final _responsiveUtils = Get.find<ResponsiveUtils>();
|
||||
|
||||
bool _popupMenuVisible = false;
|
||||
|
||||
@@ -121,15 +119,11 @@ class _DesktopListEmailActionHoverWidgetState
|
||||
: Colors.transparent,
|
||||
tooltipMessage: AppLocalizations.of(context).more,
|
||||
onTapActionAtPositionCallback: (position) {
|
||||
if (_responsiveUtils.isScreenWithShortestSide(context)) {
|
||||
widget.onMoreActionClick?.call(widget.presentationEmail, null);
|
||||
} else {
|
||||
_onPopupMenuVisibleChange(true);
|
||||
_onPopupMenuVisibleChange(true);
|
||||
|
||||
widget.onMoreActionClick
|
||||
?.call(widget.presentationEmail, position)
|
||||
.whenComplete(() => _onPopupMenuVisibleChange(false));
|
||||
}
|
||||
widget.onMoreActionClick
|
||||
?.call(widget.presentationEmail, position)
|
||||
.whenComplete(() => _onPopupMenuVisibleChange(false));
|
||||
},
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import 'package:core/presentation/extensions/color_extension.dart';
|
||||
import 'package:core/presentation/resources/image_paths.dart';
|
||||
import 'package:core/presentation/utils/responsive_utils.dart';
|
||||
import 'package:core/presentation/views/button/tmail_button_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
@@ -54,7 +53,6 @@ class WebTabletBodyEmailItemWidget extends StatefulWidget {
|
||||
class _WebTabletBodyEmailItemWidgetState
|
||||
extends State<WebTabletBodyEmailItemWidget> with BaseEmailItemTile {
|
||||
final _imagePaths = Get.find<ImagePaths>();
|
||||
final _responsiveUtils = Get.find<ResponsiveUtils>();
|
||||
|
||||
bool _isHover = false;
|
||||
bool _popupMenuVisible = false;
|
||||
@@ -268,18 +266,12 @@ class _WebTabletBodyEmailItemWidgetState
|
||||
: Colors.transparent,
|
||||
tooltipMessage: AppLocalizations.of(context).more,
|
||||
onTapActionAtPositionCallback: (position) {
|
||||
if (_responsiveUtils
|
||||
.isScreenWithShortestSide(context)) {
|
||||
widget.onMoreActionClick
|
||||
?.call(widget.presentationEmail, null);
|
||||
} else {
|
||||
_onPopupMenuVisibleChange(true);
|
||||
_onPopupMenuVisibleChange(true);
|
||||
|
||||
widget.onMoreActionClick
|
||||
?.call(widget.presentationEmail, position)
|
||||
.whenComplete(
|
||||
() => _onPopupMenuVisibleChange(false));
|
||||
}
|
||||
widget.onMoreActionClick
|
||||
?.call(widget.presentationEmail, position)
|
||||
.whenComplete(
|
||||
() => _onPopupMenuVisibleChange(false));
|
||||
},
|
||||
)
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user