TF-984 Apply new design for toast message when move action
This commit is contained in:
@@ -481,17 +481,28 @@ class EmailController extends BaseController with AppLoaderMixin {
|
||||
mailboxDashBoardController.dispatchState(Right(success));
|
||||
|
||||
if (success.moveAction == MoveAction.moving && currentContext != null && currentOverlayContext != null) {
|
||||
_appToast.showToastWithAction(
|
||||
currentOverlayContext!,
|
||||
success.emailActionType.getToastMessageMoveToMailboxSuccess(currentContext!, destinationPath: success.destinationPath),
|
||||
AppLocalizations.of(currentContext!).undo_action, () {
|
||||
_revertedToOriginalMailbox(MoveToMailboxRequest(
|
||||
_appToast.showBottomToast(
|
||||
currentOverlayContext!,
|
||||
success.emailActionType.getToastMessageMoveToMailboxSuccess(currentContext!, destinationPath: success.destinationPath),
|
||||
actionName: AppLocalizations.of(currentContext!).undo,
|
||||
onActionClick: () {
|
||||
_revertedToOriginalMailbox(MoveToMailboxRequest(
|
||||
[success.emailId],
|
||||
success.destinationMailboxId,
|
||||
success.currentMailboxId,
|
||||
MoveAction.undo,
|
||||
success.emailActionType));
|
||||
},
|
||||
},
|
||||
leadingIcon: SvgPicture.asset(
|
||||
imagePaths.icFolderMailbox,
|
||||
width: 24,
|
||||
height: 24,
|
||||
color: Colors.white,
|
||||
fit: BoxFit.fill),
|
||||
backgroundColor: AppColor.toastSuccessBackgroundColor,
|
||||
textColor: Colors.white,
|
||||
textActionColor: Colors.white,
|
||||
actionIcon: SvgPicture.asset(imagePaths.icUndo),
|
||||
maxWidth: responsiveUtils.getMaxWidthToast(currentContext!)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -400,11 +400,19 @@ class MailboxController extends BaseMailboxController {
|
||||
|
||||
void _createNewMailboxSuccess(CreateNewMailboxSuccess success) {
|
||||
if (currentOverlayContext != null && currentContext != null) {
|
||||
_appToast.showToastWithIcon(
|
||||
_appToast.showBottomToast(
|
||||
currentOverlayContext!,
|
||||
textColor: AppColor.toastSuccessBackgroundColor,
|
||||
message: AppLocalizations.of(currentContext!).new_mailbox_is_created(success.newMailbox.name?.name ?? ''),
|
||||
icon: _imagePaths.icFolderMailbox);
|
||||
AppLocalizations.of(currentContext!).new_mailbox_is_created(success.newMailbox.name?.name ?? ''),
|
||||
leadingIcon: SvgPicture.asset(
|
||||
_imagePaths.icFolderMailbox,
|
||||
width: 24,
|
||||
height: 24,
|
||||
color: Colors.white,
|
||||
fit: BoxFit.fill),
|
||||
backgroundColor: AppColor.toastSuccessBackgroundColor,
|
||||
textColor: Colors.white,
|
||||
textActionColor: Colors.white,
|
||||
maxWidth: _responsiveUtils.getMaxWidthToast(currentContext!));
|
||||
}
|
||||
|
||||
refreshMailboxChanges(currentMailboxState: success.currentMailboxState);
|
||||
@@ -418,11 +426,19 @@ class MailboxController extends BaseMailboxController {
|
||||
messageError = exception.description ?? AppLocalizations.of(currentContext!).create_new_mailbox_failure;
|
||||
}
|
||||
|
||||
_appToast.showToastWithIcon(
|
||||
_appToast.showBottomToast(
|
||||
currentOverlayContext!,
|
||||
message: messageError,
|
||||
iconColor: AppColor.toastErrorBackgroundColor,
|
||||
icon: _imagePaths.icNotConnection);
|
||||
messageError,
|
||||
leadingIcon: SvgPicture.asset(
|
||||
_imagePaths.icNotConnection,
|
||||
width: 24,
|
||||
height: 24,
|
||||
color: Colors.white,
|
||||
fit: BoxFit.fill),
|
||||
backgroundColor: AppColor.toastErrorBackgroundColor,
|
||||
textColor: Colors.white,
|
||||
textActionColor: Colors.white,
|
||||
maxWidth: _responsiveUtils.getMaxWidthToast(currentContext!));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -761,18 +777,28 @@ class MailboxController extends BaseMailboxController {
|
||||
if (success.moveAction == MoveAction.moving
|
||||
&& currentOverlayContext != null
|
||||
&& currentContext != null) {
|
||||
_appToast.showToastWithAction(
|
||||
_appToast.showBottomToast(
|
||||
currentOverlayContext!,
|
||||
AppLocalizations.of(currentContext!).moved_to_mailbox(
|
||||
success.destinationMailboxName?.name ?? AppLocalizations.of(currentContext!).allMailboxes),
|
||||
AppLocalizations.of(currentContext!).undo_action,
|
||||
() {
|
||||
actionName: AppLocalizations.of(currentContext!).undo,
|
||||
onActionClick: () {
|
||||
_undoMovingMailbox(MoveMailboxRequest(
|
||||
success.mailboxIdSelected,
|
||||
MoveAction.undo,
|
||||
destinationMailboxId: success.parentId,
|
||||
parentId: success.destinationMailboxId));
|
||||
},
|
||||
leadingIcon: SvgPicture.asset(
|
||||
_imagePaths.icFolderMailbox,
|
||||
width: 24,
|
||||
height: 24,
|
||||
color: Colors.white,
|
||||
fit: BoxFit.fill),
|
||||
backgroundColor: AppColor.toastSuccessBackgroundColor,
|
||||
textColor: Colors.white,
|
||||
textActionColor: Colors.white,
|
||||
actionIcon: SvgPicture.asset(_imagePaths.icUndo),
|
||||
maxWidth: _responsiveUtils.getMaxWidthToast(currentContext!));
|
||||
}
|
||||
|
||||
|
||||
+39
-8
@@ -448,11 +448,21 @@ class MailboxDashBoardController extends ReloadableController {
|
||||
|
||||
void _saveEmailAsDraftsSuccess(SaveEmailAsDraftsSuccess success) {
|
||||
if (currentContext != null && currentOverlayContext != null) {
|
||||
_appToast.showToastWithAction(
|
||||
_appToast.showBottomToast(
|
||||
currentOverlayContext!,
|
||||
AppLocalizations.of(currentContext!).drafts_saved,
|
||||
AppLocalizations.of(currentContext!).discard,
|
||||
() => _discardEmail(success.emailAsDrafts),
|
||||
actionName: AppLocalizations.of(currentContext!).discard,
|
||||
onActionClick: () => _discardEmail(success.emailAsDrafts),
|
||||
leadingIcon: SvgPicture.asset(
|
||||
_imagePaths.icMailboxDrafts,
|
||||
width: 24,
|
||||
height: 24,
|
||||
color: Colors.white,
|
||||
fit: BoxFit.fill),
|
||||
backgroundColor: AppColor.toastSuccessBackgroundColor,
|
||||
textColor: Colors.white,
|
||||
textActionColor: Colors.white,
|
||||
actionIcon: SvgPicture.asset(_imagePaths.icUndo),
|
||||
maxWidth: _responsiveUtils.getMaxWidthToast(currentContext!)
|
||||
);
|
||||
}
|
||||
@@ -464,10 +474,11 @@ class MailboxDashBoardController extends ReloadableController {
|
||||
|
||||
void _moveToMailboxSuccess(MoveToMailboxSuccess success) {
|
||||
if (success.moveAction == MoveAction.moving && currentContext != null && currentOverlayContext != null) {
|
||||
_appToast.showToastWithAction(
|
||||
_appToast.showBottomToast(
|
||||
currentOverlayContext!,
|
||||
success.emailActionType.getToastMessageMoveToMailboxSuccess(currentContext!, destinationPath: success.destinationPath),
|
||||
AppLocalizations.of(currentContext!).undo_action, () {
|
||||
actionName: AppLocalizations.of(currentContext!).undo,
|
||||
onActionClick: () {
|
||||
_revertedToOriginalMailbox(MoveToMailboxRequest(
|
||||
[success.emailId],
|
||||
success.destinationMailboxId,
|
||||
@@ -475,6 +486,16 @@ class MailboxDashBoardController extends ReloadableController {
|
||||
MoveAction.undo,
|
||||
success.emailActionType));
|
||||
},
|
||||
leadingIcon: SvgPicture.asset(
|
||||
_imagePaths.icFolderMailbox,
|
||||
width: 24,
|
||||
height: 24,
|
||||
color: Colors.white,
|
||||
fit: BoxFit.fill),
|
||||
backgroundColor: AppColor.toastSuccessBackgroundColor,
|
||||
textColor: Colors.white,
|
||||
textActionColor: Colors.white,
|
||||
actionIcon: SvgPicture.asset(_imagePaths.icUndo),
|
||||
maxWidth: _responsiveUtils.getMaxWidthToast(currentContext!)
|
||||
);
|
||||
}
|
||||
@@ -673,13 +694,13 @@ class MailboxDashBoardController extends ReloadableController {
|
||||
currentOverlayContext != null &&
|
||||
emailActionType != null &&
|
||||
moveAction == MoveAction.moving) {
|
||||
_appToast.showToastWithAction(
|
||||
_appToast.showBottomToast(
|
||||
currentOverlayContext!,
|
||||
emailActionType.getToastMessageMoveToMailboxSuccess(
|
||||
currentContext!,
|
||||
destinationPath: destinationPath),
|
||||
AppLocalizations.of(currentContext!).undo_action,
|
||||
() {
|
||||
actionName: AppLocalizations.of(currentContext!).undo,
|
||||
onActionClick: () {
|
||||
final newCurrentMailboxId = destinationMailboxId;
|
||||
final newDestinationMailboxId = currentMailboxId;
|
||||
if (newCurrentMailboxId != null && newDestinationMailboxId != null) {
|
||||
@@ -692,6 +713,16 @@ class MailboxDashBoardController extends ReloadableController {
|
||||
destinationPath: destinationPath));
|
||||
}
|
||||
},
|
||||
leadingIcon: SvgPicture.asset(
|
||||
_imagePaths.icFolderMailbox,
|
||||
width: 24,
|
||||
height: 24,
|
||||
color: Colors.white,
|
||||
fit: BoxFit.fill),
|
||||
backgroundColor: AppColor.toastSuccessBackgroundColor,
|
||||
textColor: Colors.white,
|
||||
textActionColor: Colors.white,
|
||||
actionIcon: SvgPicture.asset(_imagePaths.icUndo),
|
||||
maxWidth: _responsiveUtils.getMaxWidthToast(currentContext!)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -701,10 +701,11 @@ class ThreadController extends BaseController {
|
||||
|
||||
if (currentContext != null && currentOverlayContext != null
|
||||
&& emailActionType != null && moveAction == MoveAction.moving) {
|
||||
_appToast.showToastWithAction(
|
||||
_appToast.showBottomToast(
|
||||
currentOverlayContext!,
|
||||
emailActionType.getToastMessageMoveToMailboxSuccess(currentContext!, destinationPath: destinationPath),
|
||||
AppLocalizations.of(currentContext!).undo_action, () {
|
||||
actionName: AppLocalizations.of(currentContext!).undo,
|
||||
onActionClick: () {
|
||||
final newCurrentMailboxId = destinationMailboxId;
|
||||
final newDestinationMailboxId = currentMailboxId;
|
||||
if (newCurrentMailboxId != null && newDestinationMailboxId != null) {
|
||||
@@ -717,6 +718,16 @@ class ThreadController extends BaseController {
|
||||
destinationPath: destinationPath));
|
||||
}
|
||||
},
|
||||
leadingIcon: SvgPicture.asset(
|
||||
_imagePaths.icFolderMailbox,
|
||||
width: 24,
|
||||
height: 24,
|
||||
color: Colors.white,
|
||||
fit: BoxFit.fill),
|
||||
backgroundColor: AppColor.toastSuccessBackgroundColor,
|
||||
textColor: Colors.white,
|
||||
textActionColor: Colors.white,
|
||||
actionIcon: SvgPicture.asset(_imagePaths.icUndo),
|
||||
maxWidth: _responsiveUtils.getMaxWidthToast(currentContext!)
|
||||
);
|
||||
}
|
||||
@@ -1101,10 +1112,11 @@ class ThreadController extends BaseController {
|
||||
mailboxDashBoardController.dispatchState(Right(success));
|
||||
|
||||
if (success.moveAction == MoveAction.moving && currentContext != null && currentOverlayContext != null) {
|
||||
_appToast.showToastWithAction(
|
||||
_appToast.showBottomToast(
|
||||
currentOverlayContext!,
|
||||
AppLocalizations.of(currentContext!).moved_to_mailbox(success.destinationPath ?? ''),
|
||||
AppLocalizations.of(currentContext!).undo_action, () {
|
||||
actionName: AppLocalizations.of(currentContext!).undo,
|
||||
onActionClick: () {
|
||||
_revertedToOriginalMailbox(MoveToMailboxRequest(
|
||||
[success.emailId],
|
||||
success.destinationMailboxId,
|
||||
@@ -1112,6 +1124,16 @@ class ThreadController extends BaseController {
|
||||
MoveAction.undo,
|
||||
success.emailActionType));
|
||||
},
|
||||
leadingIcon: SvgPicture.asset(
|
||||
_imagePaths.icFolderMailbox,
|
||||
width: 24,
|
||||
height: 24,
|
||||
color: Colors.white,
|
||||
fit: BoxFit.fill),
|
||||
backgroundColor: AppColor.toastSuccessBackgroundColor,
|
||||
textColor: Colors.white,
|
||||
textActionColor: Colors.white,
|
||||
actionIcon: SvgPicture.asset(_imagePaths.icUndo),
|
||||
maxWidth: _responsiveUtils.getMaxWidthToast(currentContext!)
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user