From 232987ae0c125d95cfba54dfa9fb4c985831face Mon Sep 17 00:00:00 2001 From: dab246 Date: Thu, 16 Apr 2026 16:14:38 +0700 Subject: [PATCH] TF-4301 Extract onMoreActionClick callback into dedicated method in ThreadView --- .../thread/presentation/thread_view.dart | 81 +++++++++++-------- 1 file changed, 46 insertions(+), 35 deletions(-) diff --git a/lib/features/thread/presentation/thread_view.dart b/lib/features/thread/presentation/thread_view.dart index 0646efad3..43b0200bd 100644 --- a/lib/features/thread/presentation/thread_view.dart +++ b/lib/features/thread/presentation/thread_view.dart @@ -611,46 +611,57 @@ class ThreadView extends GetWidget isLabelMailboxOpened: isLabelMailboxOpened, labels: emailLabels, emailActionClick: _handleEmailActionClicked, - onMoreActionClick: (email, position) async { - await openMoreActionContextMenu( - EmailContextMenuParams( - context: context, - email: email, - imagePaths: controller.imagePaths, - isLabelAvailable: isLabelAvailable, - labels: listLabels, - position: position, - openBottomSheetContextMenu: dashboardController.openBottomSheetContextMenu, - openPopupMenu: dashboardController.openPopupMenuActionGroup, - onHandleEmailByActionType: controller.handleEmailActionType, - onSelectLabelAction: (label, isSelected) { - final emailId = presentationEmail.id; - if (emailId == null) { - logWarning('ThreadView::onSelectLabelAction: Email id is null'); - return; - } - dashboardController.toggleLabelToEmail( - emailId, - label, - isSelected, - ); - }, - onCreateANewLabelAction: () { - dashboardController.labelController.handleLabelActionType( - actionType: LabelActionType.create, - accountId: dashboardController.accountId.value, - onLabelActionCallback: (label) => dashboardController - .toggleLabelToEmail(email.id!, label, true), - ); - }, - ), - ); - } + onMoreActionClick: (email, position) => _openMoreActionForEmail( + context: context, + email: email, + position: position, + isLabelAvailable: isLabelAvailable, + listLabels: listLabels, + ), ), ); }); } + Future _openMoreActionForEmail({ + required BuildContext context, + required PresentationEmail email, + required RelativeRect? position, + required bool isLabelAvailable, + required List