diff --git a/lib/features/search/email/presentation/search_email_view.dart b/lib/features/search/email/presentation/search_email_view.dart index 262e6deb75..332ebc84d9 100644 --- a/lib/features/search/email/presentation/search_email_view.dart +++ b/lib/features/search/email/presentation/search_email_view.dart @@ -39,6 +39,7 @@ import 'package:tmail_ui_user/features/thread/presentation/styles/item_email_til import 'package:tmail_ui_user/features/thread/presentation/widgets/email_tile_builder.dart' if (dart.library.html) 'package:tmail_ui_user/features/thread/presentation/widgets/email_tile_web_builder.dart'; import 'package:tmail_ui_user/main/localizations/app_localizations.dart'; +import 'package:tmail_ui_user/main/routes/route_navigation.dart'; class SearchEmailView extends GetWidget with AppLoaderMixin { @@ -746,6 +747,7 @@ class SearchEmailView extends GetWidget List _contextMenuActionTile(BuildContext context, PresentationEmail email) { return [ _markAsEmailSpamOrUnSpamAction(context, email), + _editAsNewEmailContextMenuItemAction(context, email), ]; } @@ -778,11 +780,43 @@ class SearchEmailView extends GetWidget .build(); } + Widget _editAsNewEmailContextMenuItemAction( + BuildContext context, + PresentationEmail email, + ) { + return ( + EmailActionCupertinoActionSheetActionBuilder( + const Key('edit_as_new_email_action'), + SvgPicture.asset( + controller.imagePaths.icEdit, + width: 24, + height: 24, + fit: BoxFit.fill, + colorFilter: AppColor.colorTextButton.asFilter() + ), + AppLocalizations.of(context).editAsNewEmail, + email, + iconLeftPadding: controller.responsiveUtils.isMobile(context) + ? const EdgeInsets.only(left: 12, right: 16) + : const EdgeInsets.only(right: 12), + iconRightPadding: controller.responsiveUtils.isMobile(context) + ? const EdgeInsets.only(right: 12) + : EdgeInsets.zero) + ..onActionClick((email) { + popBack(); + controller.editAsNewEmail(email); + }) + ).build(); + } + List _popupMenuActionTile(BuildContext context, PresentationEmail email) { return [ PopupMenuItem( padding: const EdgeInsets.symmetric(horizontal: 8), child: _markAsEmailSpamOrUnSpamAction(context, email)), + PopupMenuItem( + padding: const EdgeInsets.symmetric(horizontal: 8), + child: _editAsNewEmailContextMenuItemAction(context, email)), ]; } diff --git a/lib/features/thread/presentation/mixin/email_action_controller.dart b/lib/features/thread/presentation/mixin/email_action_controller.dart index 64e4b1e724..280337c0ca 100644 --- a/lib/features/thread/presentation/mixin/email_action_controller.dart +++ b/lib/features/thread/presentation/mixin/email_action_controller.dart @@ -43,6 +43,12 @@ mixin EmailActionController { mailboxDashBoardController.goToComposer(ComposerArguments.editDraftEmail(presentationEmail)); } + void editAsNewEmail(PresentationEmail presentationEmail) { + mailboxDashBoardController.goToComposer( + ComposerArguments.fromPresentationEmail(presentationEmail), + ); + } + void previewEmail(PresentationEmail presentationEmail) { log('EmailActionController::previewEmail():presentationEmailId: ${presentationEmail.id}'); mailboxDashBoardController.openEmailDetailedView(presentationEmail); diff --git a/lib/features/thread/presentation/thread_controller.dart b/lib/features/thread/presentation/thread_controller.dart index 6ab3605c1d..acb1556ca5 100644 --- a/lib/features/thread/presentation/thread_controller.dart +++ b/lib/features/thread/presentation/thread_controller.dart @@ -1127,6 +1127,9 @@ class ThreadController extends BaseController with EmailActionController { case EmailActionType.preview: if (mailboxContain?.isDrafts == true) { editDraftEmail(selectedEmail); + } else if (mailboxContain?.isTemplates == true) { + popBack(); + editAsNewEmail(selectedEmail); } else { previewEmail(selectedEmail); } diff --git a/lib/features/thread/presentation/thread_view.dart b/lib/features/thread/presentation/thread_view.dart index 0d7f5c6df9..d26a6750a1 100644 --- a/lib/features/thread/presentation/thread_view.dart +++ b/lib/features/thread/presentation/thread_view.dart @@ -804,9 +804,7 @@ class ThreadView extends GetWidget : EdgeInsets.zero) ..onActionClick((email) { popBack(); - controller.mailboxDashBoardController.goToComposer( - ComposerArguments.fromPresentationEmail(email) - ); + controller.editAsNewEmail(email); }) ).build(); } @@ -915,9 +913,7 @@ class ThreadView extends GetWidget ), onCallbackAction: () { popBack(); - controller.mailboxDashBoardController.goToComposer( - ComposerArguments.fromPresentationEmail(email) - ); + controller.editAsNewEmail(email); } ) );