From 0913a732867d94349c61cc713d1a83e7af1067db Mon Sep 17 00:00:00 2001 From: HuyNguyen Date: Tue, 28 Feb 2023 10:28:50 +0700 Subject: [PATCH] TF-1472: Fixed popup when sending email should be displayed at the bottom of screen --- core/lib/presentation/utils/app_toast.dart | 6 +++++- .../composer/presentation/composer_controller.dart | 13 +++++++------ .../controller/mailbox_dashboard_controller.dart | 4 +++- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/core/lib/presentation/utils/app_toast.dart b/core/lib/presentation/utils/app_toast.dart index 3b95bdeeb..15f230c72 100644 --- a/core/lib/presentation/utils/app_toast.dart +++ b/core/lib/presentation/utils/app_toast.dart @@ -148,7 +148,8 @@ class AppToast { void showToastWithIcon(BuildContext context, { String? message, String? icon, Color? bgColor, Color? iconColor, Color? textColor, double? radius, EdgeInsets? padding, - TextStyle? textStyle, double? widthToast, Duration? toastLength}) { + TextStyle? textStyle, double? widthToast, Duration? toastLength, + Duration? delayTime}) async { double sizeWidth = context.width > 360 ? 360 : context.width - 40; final toast = Material( color: bgColor ?? Colors.white, @@ -181,6 +182,9 @@ class AppToast { ), ); fToast.init(context); + if (delayTime != null) { + await Future.delayed(delayTime); + } fToast.showToast( child: toast, gravity: ToastGravity.BOTTOM, diff --git a/lib/features/composer/presentation/composer_controller.dart b/lib/features/composer/presentation/composer_controller.dart index 02eced7ab..c845ff7e8 100644 --- a/lib/features/composer/presentation/composer_controller.dart +++ b/lib/features/composer/presentation/composer_controller.dart @@ -750,6 +750,13 @@ class ComposerController extends BaseController { final sentMailboxId = mailboxDashBoardController.mapDefaultMailboxIdByRole[PresentationMailbox.roleSent]; final outboxMailboxId = mailboxDashBoardController.outboxMailbox?.id; final userProfile = mailboxDashBoardController.userProfile.value; + + if (kIsWeb) { + closeComposerWeb(); + } else { + popBack(); + } + if (arguments != null && accountId != null && userProfile != null) { final email = await _generateEmail(context, userProfile, outboxMailboxId: outboxMailboxId); final submissionCreateId = Id(_uuid.v1()); @@ -775,12 +782,6 @@ class ComposerController extends BaseController { uploadController.clearInlineFileUploaded(); } - - if (kIsWeb) { - closeComposerWeb(); - } else { - popBack(); - } } void _checkContactPermission() async { diff --git a/lib/features/mailbox_dashboard/presentation/controller/mailbox_dashboard_controller.dart b/lib/features/mailbox_dashboard/presentation/controller/mailbox_dashboard_controller.dart index a9941c6f3..b8d3792aa 100644 --- a/lib/features/mailbox_dashboard/presentation/controller/mailbox_dashboard_controller.dart +++ b/lib/features/mailbox_dashboard/presentation/controller/mailbox_dashboard_controller.dart @@ -260,7 +260,9 @@ class MailboxDashBoardController extends ReloadableController { _appToast.showToastWithIcon( currentOverlayContext!, message: AppLocalizations.of(currentContext!).your_email_being_sent, - icon: _imagePaths.icSendToast); + icon: _imagePaths.icSendToast, + delayTime: const Duration(seconds: 1), + ); } } else if (success is GetEmailStateToRefreshSuccess) { dispatchEmailUIAction(RefreshChangeEmailAction(success.storedState));