TF-248 Change ui toast notification
This commit is contained in:
@@ -77,6 +77,7 @@ class ThreadBindings extends Bindings {
|
||||
Get.find<ScrollController>(),
|
||||
Get.find<MarkAsMultipleEmailReadInteractor>(),
|
||||
Get.find<AppToast>(),
|
||||
Get.find<ImagePaths>(),
|
||||
Get.find<MoveMultipleEmailToMailboxInteractor>(),
|
||||
Get.find<MarkAsStarEmailInteractor>(),
|
||||
Get.find<MarkAsStarMultipleEmailInteractor>(),
|
||||
|
||||
@@ -52,6 +52,7 @@ class ThreadController extends BaseController {
|
||||
final MarkAsMultipleEmailReadInteractor _markAsMultipleEmailReadInteractor;
|
||||
final AppToast _appToast;
|
||||
final ResponsiveUtils responsiveUtils;
|
||||
final ImagePaths _imagePaths;
|
||||
final ScrollController listEmailController;
|
||||
final MoveMultipleEmailToMailboxInteractor _moveMultipleEmailToMailboxInteractor;
|
||||
final MarkAsStarEmailInteractor _markAsStarEmailInteractor;
|
||||
@@ -89,6 +90,7 @@ class ThreadController extends BaseController {
|
||||
this.listEmailController,
|
||||
this._markAsMultipleEmailReadInteractor,
|
||||
this._appToast,
|
||||
this._imagePaths,
|
||||
this._moveMultipleEmailToMailboxInteractor,
|
||||
this._markAsStarEmailInteractor,
|
||||
this._markAsStarMultipleEmailInteractor,
|
||||
@@ -373,20 +375,21 @@ class ThreadController extends BaseController {
|
||||
mailboxDashBoardController.dispatchState(Right(success));
|
||||
|
||||
ReadActions? readActions;
|
||||
int countMarkAsReadSuccess = 0;
|
||||
|
||||
if (success is MarkAsMultipleEmailReadAllSuccess) {
|
||||
readActions = success.readActions;
|
||||
countMarkAsReadSuccess = success.countMarkAsReadSuccess;
|
||||
} else if (success is MarkAsMultipleEmailReadHasSomeEmailFailure) {
|
||||
readActions = success.readActions;
|
||||
countMarkAsReadSuccess = success.countMarkAsReadSuccess;
|
||||
}
|
||||
|
||||
if (Get.context != null && readActions != null) {
|
||||
_appToast.showSuccessToast(readActions == ReadActions.markAsUnread
|
||||
? AppLocalizations.of(Get.context!).marked_multiple_item_as_unread(countMarkAsReadSuccess)
|
||||
: AppLocalizations.of(Get.context!).marked_multiple_item_as_read(countMarkAsReadSuccess));
|
||||
if (Get.context != null && readActions != null && Get.overlayContext != null) {
|
||||
final message = readActions == ReadActions.markAsUnread
|
||||
? AppLocalizations.of(Get.context!).marked_message_toast(AppLocalizations.of(Get.context!).unread)
|
||||
: AppLocalizations.of(Get.context!).marked_message_toast(AppLocalizations.of(Get.context!).read);
|
||||
_appToast.showToastWithIcon(
|
||||
Get.overlayContext!,
|
||||
message: message,
|
||||
icon: readActions == ReadActions.markAsUnread ? _imagePaths.icUnreadToast : _imagePaths.icReadToast);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import 'package:core/core.dart';
|
||||
import 'package:core/presentation/utils/app_toast.dart';
|
||||
import 'package:device_info/device_info.dart';
|
||||
import 'package:fluttertoast/fluttertoast.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:tmail_ui_user/features/email/data/local/html_analyzer.dart';
|
||||
@@ -39,6 +39,7 @@ class CoreBindings extends Bindings {
|
||||
}
|
||||
|
||||
void _bindingToast() {
|
||||
Get.put(FToast());
|
||||
Get.put(AppToast());
|
||||
}
|
||||
|
||||
|
||||
@@ -518,4 +518,12 @@ class AppLocalizations {
|
||||
'This feature is under development.',
|
||||
name: 'the_feature_is_under_development');
|
||||
}
|
||||
|
||||
String marked_message_toast(String action) {
|
||||
return Intl.message(
|
||||
'You’ve marked messages as "$action"',
|
||||
name: 'marked_message_toast',
|
||||
args: [action]
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user