TF-1472: Fixed popup when sending email should be displayed at the bottom of screen

This commit is contained in:
HuyNguyen
2023-02-28 10:28:50 +07:00
committed by Dat Vu
parent 42a1cfab0b
commit 0913a73286
3 changed files with 15 additions and 8 deletions
+5 -1
View File
@@ -148,7 +148,8 @@ class AppToast {
void showToastWithIcon(BuildContext context, { void showToastWithIcon(BuildContext context, {
String? message, String? icon, Color? bgColor, Color? iconColor, String? message, String? icon, Color? bgColor, Color? iconColor,
Color? textColor, double? radius, EdgeInsets? padding, 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; double sizeWidth = context.width > 360 ? 360 : context.width - 40;
final toast = Material( final toast = Material(
color: bgColor ?? Colors.white, color: bgColor ?? Colors.white,
@@ -181,6 +182,9 @@ class AppToast {
), ),
); );
fToast.init(context); fToast.init(context);
if (delayTime != null) {
await Future.delayed(delayTime);
}
fToast.showToast( fToast.showToast(
child: toast, child: toast,
gravity: ToastGravity.BOTTOM, gravity: ToastGravity.BOTTOM,
@@ -750,6 +750,13 @@ class ComposerController extends BaseController {
final sentMailboxId = mailboxDashBoardController.mapDefaultMailboxIdByRole[PresentationMailbox.roleSent]; final sentMailboxId = mailboxDashBoardController.mapDefaultMailboxIdByRole[PresentationMailbox.roleSent];
final outboxMailboxId = mailboxDashBoardController.outboxMailbox?.id; final outboxMailboxId = mailboxDashBoardController.outboxMailbox?.id;
final userProfile = mailboxDashBoardController.userProfile.value; final userProfile = mailboxDashBoardController.userProfile.value;
if (kIsWeb) {
closeComposerWeb();
} else {
popBack();
}
if (arguments != null && accountId != null && userProfile != null) { if (arguments != null && accountId != null && userProfile != null) {
final email = await _generateEmail(context, userProfile, outboxMailboxId: outboxMailboxId); final email = await _generateEmail(context, userProfile, outboxMailboxId: outboxMailboxId);
final submissionCreateId = Id(_uuid.v1()); final submissionCreateId = Id(_uuid.v1());
@@ -775,12 +782,6 @@ class ComposerController extends BaseController {
uploadController.clearInlineFileUploaded(); uploadController.clearInlineFileUploaded();
} }
if (kIsWeb) {
closeComposerWeb();
} else {
popBack();
}
} }
void _checkContactPermission() async { void _checkContactPermission() async {
@@ -260,7 +260,9 @@ class MailboxDashBoardController extends ReloadableController {
_appToast.showToastWithIcon( _appToast.showToastWithIcon(
currentOverlayContext!, currentOverlayContext!,
message: AppLocalizations.of(currentContext!).your_email_being_sent, message: AppLocalizations.of(currentContext!).your_email_being_sent,
icon: _imagePaths.icSendToast); icon: _imagePaths.icSendToast,
delayTime: const Duration(seconds: 1),
);
} }
} else if (success is GetEmailStateToRefreshSuccess) { } else if (success is GetEmailStateToRefreshSuccess) {
dispatchEmailUIAction(RefreshChangeEmailAction(success.storedState)); dispatchEmailUIAction(RefreshChangeEmailAction(success.storedState));