TF-1594 Use only one class TmailToast to display the message.
(cherry picked from commit 379c34b32b2e5c4dad141e6a98bdb92597fa6908)
This commit is contained in:
@@ -123,10 +123,9 @@ class EmailRulesController extends BaseController {
|
||||
void _createNewRuleFilterSuccess(CreateNewRuleFilterSuccess success) {
|
||||
if (success.newListRules.isNotEmpty == true) {
|
||||
if (currentOverlayContext != null && currentContext != null) {
|
||||
_appToast.showToastWithIcon(
|
||||
currentOverlayContext!,
|
||||
message: AppLocalizations.of(currentContext!).newFilterWasCreated,
|
||||
icon: _imagePaths.icSelected);
|
||||
_appToast.showToastSuccessMessage(
|
||||
currentOverlayContext!,
|
||||
AppLocalizations.of(currentContext!).newFilterWasCreated);
|
||||
}
|
||||
listEmailRule.value = success.newListRules;
|
||||
listEmailRule.refresh();
|
||||
@@ -176,10 +175,9 @@ class EmailRulesController extends BaseController {
|
||||
void _editEmailRuleFilterSuccess(EditEmailRuleFilterSuccess success) {
|
||||
if (success.listRulesUpdated.isNotEmpty == true) {
|
||||
if (currentOverlayContext != null && currentContext != null) {
|
||||
_appToast.showToastWithIcon(
|
||||
currentOverlayContext!,
|
||||
message: AppLocalizations.of(currentContext!).yourFilterHasBeenUpdated,
|
||||
icon: _imagePaths.icSelected);
|
||||
_appToast.showToastSuccessMessage(
|
||||
currentOverlayContext!,
|
||||
AppLocalizations.of(currentContext!).yourFilterHasBeenUpdated);
|
||||
}
|
||||
listEmailRule.value = success.listRulesUpdated;
|
||||
listEmailRule.refresh();
|
||||
@@ -239,11 +237,9 @@ class EmailRulesController extends BaseController {
|
||||
|
||||
void _handleDeleteEmailRuleSuccess(DeleteEmailRuleSuccess success) {
|
||||
if (currentOverlayContext != null && currentContext != null) {
|
||||
_appToast.showToastWithIcon(
|
||||
_appToast.showToastSuccessMessage(
|
||||
currentOverlayContext!,
|
||||
message: AppLocalizations.of(currentContext!).toastMessageDeleteEmailRuleSuccessfully,
|
||||
icon: _imagePaths.icSelected,
|
||||
);
|
||||
AppLocalizations.of(currentContext!).toastMessageDeleteEmailRuleSuccessfully);
|
||||
}
|
||||
|
||||
if (success.rules?.isNotEmpty == true) {
|
||||
|
||||
@@ -151,11 +151,9 @@ class ForwardController extends BaseController {
|
||||
|
||||
void _handleDeleteRecipientSuccess(DeleteRecipientInForwardingSuccess success) {
|
||||
if (currentOverlayContext != null && currentContext != null) {
|
||||
_appToast.showToastWithIcon(
|
||||
_appToast.showToastSuccessMessage(
|
||||
currentOverlayContext!,
|
||||
message: AppLocalizations.of(currentContext!).toastMessageDeleteRecipientSuccessfully,
|
||||
icon: _imagePaths.icSelected,
|
||||
);
|
||||
AppLocalizations.of(currentContext!).toastMessageDeleteRecipientSuccessfully);
|
||||
}
|
||||
|
||||
currentForward.value = success.forward;
|
||||
@@ -255,11 +253,9 @@ class ForwardController extends BaseController {
|
||||
|
||||
void _handleAddRecipientsSuccess(AddRecipientsInForwardingSuccess success) {
|
||||
if (currentOverlayContext != null && currentContext != null) {
|
||||
_appToast.showToastWithIcon(
|
||||
_appToast.showToastSuccessMessage(
|
||||
currentOverlayContext!,
|
||||
message: AppLocalizations.of(currentContext!).toastMessageAddRecipientsSuccessfully,
|
||||
icon: _imagePaths.icSelected,
|
||||
);
|
||||
AppLocalizations.of(currentContext!).toastMessageAddRecipientsSuccessfully);
|
||||
}
|
||||
|
||||
currentForward.value = success.forward;
|
||||
@@ -283,13 +279,11 @@ class ForwardController extends BaseController {
|
||||
|
||||
void _handleEditLocalCopySuccess(EditLocalCopyInForwardingSuccess success) {
|
||||
if (currentOverlayContext != null && currentContext != null) {
|
||||
_appToast.showToastWithIcon(
|
||||
_appToast.showToastSuccessMessage(
|
||||
currentOverlayContext!,
|
||||
message: success.forward.localCopy ?
|
||||
AppLocalizations.of(currentContext!).toastMessageLocalCopyEnable :
|
||||
AppLocalizations.of(currentContext!).toastMessageLocalCopyDisable,
|
||||
icon: _imagePaths.icSelected,
|
||||
);
|
||||
success.forward.localCopy
|
||||
? AppLocalizations.of(currentContext!).toastMessageLocalCopyEnable
|
||||
: AppLocalizations.of(currentContext!).toastMessageLocalCopyDisable);
|
||||
}
|
||||
|
||||
currentForward.value = success.forward;
|
||||
|
||||
@@ -133,19 +133,9 @@ class ForwardView extends GetWidget<ForwardController> with AppLoaderMixin {
|
||||
controller.addRecipientAction(context, listRecipientsSelected);
|
||||
},
|
||||
onExceptionCallback: () {
|
||||
_appToast.showBottomToast(
|
||||
_appToast.showToastErrorMessage(
|
||||
context,
|
||||
AppLocalizations.of(context).incorrectEmailFormat,
|
||||
leadingIcon: SvgPicture.asset(
|
||||
_imagePaths.icNotConnection,
|
||||
width: 24,
|
||||
height: 24,
|
||||
colorFilter: Colors.white.asFilter(),
|
||||
fit: BoxFit.fill),
|
||||
backgroundColor: AppColor.toastErrorBackgroundColor,
|
||||
textColor: Colors.white,
|
||||
textActionColor: Colors.white,
|
||||
maxWidth: _responsiveUtils.getMaxWidthToast(context));
|
||||
AppLocalizations.of(context).incorrectEmailFormat);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
+16
-25
@@ -3,7 +3,6 @@ import 'package:core/presentation/resources/image_paths.dart';
|
||||
import 'package:core/presentation/state/failure.dart';
|
||||
import 'package:core/presentation/state/success.dart';
|
||||
import 'package:core/presentation/utils/app_toast.dart';
|
||||
import 'package:core/presentation/utils/responsive_utils.dart';
|
||||
import 'package:core/utils/app_logger.dart';
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -41,7 +40,6 @@ class MailboxVisibilityController extends BaseMailboxController {
|
||||
final _accountDashBoardController = Get.find<ManageAccountDashBoardController>();
|
||||
final _appToast = Get.find<AppToast>();
|
||||
final _imagePaths = Get.find<ImagePaths>();
|
||||
final _responsiveUtils = Get.find<ResponsiveUtils>();
|
||||
final mailboxListScrollController = ScrollController();
|
||||
|
||||
MailboxVisibilityController(
|
||||
@@ -209,29 +207,22 @@ class MailboxVisibilityController extends BaseMailboxController {
|
||||
{List<MailboxId>? listDescendantMailboxIds}
|
||||
) {
|
||||
if (currentOverlayContext != null && currentContext != null) {
|
||||
_appToast.showBottomToast(
|
||||
currentOverlayContext!,
|
||||
AppLocalizations.of(currentContext!).toastMsgHideMailboxSuccess,
|
||||
actionName: AppLocalizations.of(currentContext!).undo,
|
||||
onActionClick: () => _subscribeMailboxAction(
|
||||
SubscribeMailboxRequest(
|
||||
mailboxIdSubscribed,
|
||||
MailboxSubscribeState.enabled,
|
||||
MailboxSubscribeAction.subscribe
|
||||
)
|
||||
),
|
||||
leadingIcon: SvgPicture.asset(
|
||||
_imagePaths.icFolderMailbox,
|
||||
width: 24,
|
||||
height: 24,
|
||||
colorFilter: Colors.white.asFilter(),
|
||||
fit: BoxFit.fill
|
||||
),
|
||||
backgroundColor: AppColor.toastSuccessBackgroundColor,
|
||||
textColor: Colors.white,
|
||||
textActionColor: Colors.white,
|
||||
actionIcon: SvgPicture.asset(_imagePaths.icUndo),
|
||||
maxWidth: _responsiveUtils.getMaxWidthToast(currentContext!)
|
||||
_appToast.showToastMessage(
|
||||
currentOverlayContext!,
|
||||
AppLocalizations.of(currentContext!).toastMsgHideMailboxSuccess,
|
||||
actionName: AppLocalizations.of(currentContext!).undo,
|
||||
onActionClick: () => _subscribeMailboxAction(
|
||||
SubscribeMailboxRequest(
|
||||
mailboxIdSubscribed,
|
||||
MailboxSubscribeState.enabled,
|
||||
MailboxSubscribeAction.subscribe
|
||||
)
|
||||
),
|
||||
leadingSVGIconColor: Colors.white,
|
||||
leadingSVGIcon: _imagePaths.icFolderMailbox,
|
||||
backgroundColor: AppColor.toastSuccessBackgroundColor,
|
||||
textColor: Colors.white,
|
||||
actionIcon: SvgPicture.asset(_imagePaths.icUndo),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +41,6 @@ import 'package:tmail_ui_user/main/routes/route_utils.dart';
|
||||
class ManageAccountDashBoardController extends ReloadableController {
|
||||
|
||||
final _appToast = Get.find<AppToast>();
|
||||
final _imagePaths = Get.find<ImagePaths>();
|
||||
final _responsiveUtils = Get.find<ResponsiveUtils>();
|
||||
|
||||
GetAllVacationInteractor? _getAllVacationInteractor;
|
||||
@@ -268,10 +267,9 @@ class ManageAccountDashBoardController extends ReloadableController {
|
||||
void _handleUpdateVacationSuccess(UpdateVacationSuccess success) {
|
||||
if (success.listVacationResponse.isNotEmpty) {
|
||||
if (currentContext != null && currentOverlayContext != null) {
|
||||
_appToast.showToastWithIcon(
|
||||
currentOverlayContext!,
|
||||
message: AppLocalizations.of(currentContext!).yourVacationResponderIsDisabledSuccessfully,
|
||||
icon: _imagePaths.icChecked);
|
||||
_appToast.showToastSuccessMessage(
|
||||
currentOverlayContext!,
|
||||
AppLocalizations.of(currentContext!).yourVacationResponderIsDisabledSuccessfully);
|
||||
}
|
||||
vacationResponse.value = success.listVacationResponse.first;
|
||||
log('ManageAccountDashBoardController::_handleUpdateVacationSuccess(): $vacationResponse');
|
||||
|
||||
+12
-15
@@ -189,10 +189,9 @@ class IdentitiesController extends BaseController {
|
||||
|
||||
void _createNewIdentitySuccess(CreateNewIdentitySuccess success) {
|
||||
if (currentOverlayContext != null && currentContext != null) {
|
||||
_appToast.showToastWithIcon(
|
||||
currentOverlayContext!,
|
||||
message: AppLocalizations.of(currentContext!).you_have_created_a_new_identity,
|
||||
icon: _imagePaths.icSelected);
|
||||
_appToast.showToastSuccessMessage(
|
||||
currentOverlayContext!,
|
||||
AppLocalizations.of(currentContext!).you_have_created_a_new_identity);
|
||||
}
|
||||
|
||||
_refreshAllIdentities();
|
||||
@@ -200,10 +199,9 @@ class IdentitiesController extends BaseController {
|
||||
|
||||
void _createNewDefaultIdentitySuccess(CreateNewDefaultIdentitySuccess success) {
|
||||
if (currentOverlayContext != null && currentContext != null) {
|
||||
_appToast.showToastWithIcon(
|
||||
_appToast.showToastSuccessMessage(
|
||||
currentOverlayContext!,
|
||||
message: AppLocalizations.of(currentContext!).you_have_created_a_new_default_identity,
|
||||
icon: _imagePaths.icSelected);
|
||||
AppLocalizations.of(currentContext!).you_have_created_a_new_default_identity);
|
||||
}
|
||||
|
||||
_refreshAllIdentities();
|
||||
@@ -231,10 +229,10 @@ class IdentitiesController extends BaseController {
|
||||
|
||||
void _deleteIdentitySuccess(DeleteIdentitySuccess success) {
|
||||
if (currentOverlayContext != null && currentContext != null) {
|
||||
_appToast.showToastWithIcon(
|
||||
currentOverlayContext!,
|
||||
message: AppLocalizations.of(currentContext!).identity_has_been_deleted,
|
||||
icon: _imagePaths.icDeleteToast);
|
||||
_appToast.showToastSuccessMessage(
|
||||
currentOverlayContext!,
|
||||
AppLocalizations.of(currentContext!).identity_has_been_deleted,
|
||||
leadingSVGIcon: _imagePaths.icDeleteToast);
|
||||
}
|
||||
|
||||
_refreshAllIdentities();
|
||||
@@ -314,10 +312,9 @@ class IdentitiesController extends BaseController {
|
||||
|
||||
void _editIdentitySuccess(EditIdentitySuccess success) {
|
||||
if (currentOverlayContext != null && currentContext != null) {
|
||||
_appToast.showToastWithIcon(
|
||||
currentOverlayContext!,
|
||||
message: AppLocalizations.of(currentContext!).you_are_changed_your_identity_successfully,
|
||||
icon: _imagePaths.icSelected);
|
||||
_appToast.showToastSuccessMessage(
|
||||
currentOverlayContext!,
|
||||
AppLocalizations.of(currentContext!).you_are_changed_your_identity_successfully);
|
||||
}
|
||||
|
||||
_refreshAllIdentities();
|
||||
|
||||
@@ -29,7 +29,6 @@ class VacationController extends BaseController {
|
||||
|
||||
final _accountDashBoardController = Get.find<ManageAccountDashBoardController>();
|
||||
final _appToast = Get.find<AppToast>();
|
||||
final _imagePaths = Get.find<ImagePaths>();
|
||||
final _settingController = Get.find<SettingsController>();
|
||||
final _richTextControllerForWeb = Get.find<RichTextWebController>(tag: VacationUtils.vacationTagName);
|
||||
|
||||
@@ -249,33 +248,33 @@ class VacationController extends BaseController {
|
||||
if (vacationPresentation.value.isEnabled) {
|
||||
final fromDate = vacationPresentation.value.fromDate;
|
||||
if (fromDate == null) {
|
||||
_appToast.showToastWithIcon(
|
||||
context,
|
||||
bgColor: AppColor.toastErrorBackgroundColor,
|
||||
textColor: Colors.white,
|
||||
message: AppLocalizations.of(context).errorMessageWhenStartDateVacationIsEmpty);
|
||||
if (currentOverlayContext != null && currentContext != null) {
|
||||
_appToast.showToastErrorMessage(
|
||||
currentOverlayContext!,
|
||||
AppLocalizations.of(currentContext!).errorMessageWhenStartDateVacationIsEmpty);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
final vacationStopEnabled = vacationPresentation.value.vacationStopEnabled;
|
||||
final toDate = vacationPresentation.value.toDate;
|
||||
if (vacationStopEnabled && toDate != null && toDate.isBefore(fromDate)) {
|
||||
_appToast.showToastWithIcon(
|
||||
context,
|
||||
bgColor: AppColor.toastErrorBackgroundColor,
|
||||
textColor: Colors.white,
|
||||
message: AppLocalizations.of(context).errorMessageWhenEndDateVacationIsInValid);
|
||||
if (currentOverlayContext != null && currentContext != null) {
|
||||
_appToast.showToastErrorMessage(
|
||||
currentOverlayContext!,
|
||||
AppLocalizations.of(currentContext!).errorMessageWhenEndDateVacationIsInValid);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
final messagePlainText = messageTextController.text;
|
||||
final messageHtmlText = (BuildUtils.isWeb ? _vacationMessageHtmlText : await _getMessageHtmlText()) ?? '';
|
||||
if (messagePlainText.isEmpty && messageHtmlText.isEmpty && context.mounted) {
|
||||
_appToast.showToastWithIcon(
|
||||
context,
|
||||
bgColor: AppColor.toastErrorBackgroundColor,
|
||||
textColor: Colors.white,
|
||||
message: AppLocalizations.of(context).errorMessageWhenMessageVacationIsEmpty);
|
||||
if (currentOverlayContext != null && currentContext != null) {
|
||||
_appToast.showToastErrorMessage(
|
||||
currentOverlayContext!,
|
||||
AppLocalizations.of(currentContext!).errorMessageWhenMessageVacationIsEmpty);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -307,11 +306,10 @@ class VacationController extends BaseController {
|
||||
|
||||
void _handleUpdateVacationSuccess(UpdateVacationSuccess success) {
|
||||
if (success.listVacationResponse.isNotEmpty) {
|
||||
if (currentContext != null && currentOverlayContext != null) {
|
||||
_appToast.showToastWithIcon(
|
||||
currentOverlayContext!,
|
||||
message: AppLocalizations.of(currentContext!).vacationSettingSaved,
|
||||
icon: _imagePaths.icChecked);
|
||||
if (currentOverlayContext != null && currentContext != null) {
|
||||
_appToast.showToastSuccessMessage(
|
||||
currentOverlayContext!,
|
||||
AppLocalizations.of(currentContext!).vacationSettingSaved);
|
||||
}
|
||||
currentVacation = success.listVacationResponse.first;
|
||||
log('VacationController::_handleUpdateVacationSuccess(): $currentVacation');
|
||||
|
||||
Reference in New Issue
Block a user