TF-4301 Extract onMoreActionClick callback into dedicated method in ThreadView
This commit is contained in:
@@ -611,46 +611,57 @@ class ThreadView extends GetWidget<ThreadController>
|
|||||||
isLabelMailboxOpened: isLabelMailboxOpened,
|
isLabelMailboxOpened: isLabelMailboxOpened,
|
||||||
labels: emailLabels,
|
labels: emailLabels,
|
||||||
emailActionClick: _handleEmailActionClicked,
|
emailActionClick: _handleEmailActionClicked,
|
||||||
onMoreActionClick: (email, position) async {
|
onMoreActionClick: (email, position) => _openMoreActionForEmail(
|
||||||
await openMoreActionContextMenu(
|
context: context,
|
||||||
EmailContextMenuParams(
|
email: email,
|
||||||
context: context,
|
position: position,
|
||||||
email: email,
|
isLabelAvailable: isLabelAvailable,
|
||||||
imagePaths: controller.imagePaths,
|
listLabels: listLabels,
|
||||||
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),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> _openMoreActionForEmail({
|
||||||
|
required BuildContext context,
|
||||||
|
required PresentationEmail email,
|
||||||
|
required RelativeRect? position,
|
||||||
|
required bool isLabelAvailable,
|
||||||
|
required List<Label> listLabels,
|
||||||
|
}) async {
|
||||||
|
final dashboardController = controller.mailboxDashBoardController;
|
||||||
|
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 = email.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),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
Widget _buildEmailSwipeBackground(BuildContext context, PresentationEmail presentationEmail) {
|
Widget _buildEmailSwipeBackground(BuildContext context, PresentationEmail presentationEmail) {
|
||||||
return Container(
|
return Container(
|
||||||
color: AppColor.colorItemRecipientSelected,
|
color: AppColor.colorItemRecipientSelected,
|
||||||
|
|||||||
Reference in New Issue
Block a user