TF-248 Change ui toast notification
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<circle cx="12" cy="12" r="12" fill="#007AFF"/>
|
||||
<path d="M6.49316 16.5801L9.95752 13.1641L7.05176 10.3389C6.93896 10.2207 6.93896 10.0864 7.05176 10.0005L11.6494 6.44482C11.9287 6.22998 12.0791 6.12256 12.2993 6.12256C12.5195 6.12256 12.6646 6.22998 12.9492 6.44482L17.5469 10.0005C17.6597 10.0864 17.6597 10.2261 17.5469 10.3389L14.6572 13.1641L18.1055 16.5693C18.186 16.4189 18.229 16.1611 18.229 15.7959V10.3496C18.229 9.78027 18.1323 9.49561 17.7349 9.16797L13.4058 5.81104C13.0083 5.49951 12.6968 5.30078 12.2993 5.30078C11.9019 5.30078 11.5903 5.49951 11.1929 5.81104L6.8584 9.16797C6.47168 9.49023 6.36963 9.78027 6.36963 10.3496V15.7959C6.36963 16.1719 6.4126 16.4297 6.49316 16.5801ZM7.89502 17.4609H16.5425C17.0742 17.4609 17.4448 17.3643 17.6436 17.1709L12.9707 12.5518C12.7344 12.3154 12.5303 12.2134 12.3101 12.2134C12.0845 12.2134 11.8804 12.3154 11.6494 12.5518L6.94434 17.1978C7.12695 17.375 7.44385 17.4609 7.89502 17.4609Z" fill="white"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.0 KiB |
@@ -0,0 +1,4 @@
|
||||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M24 12C24 18.6274 18.6274 24 12 24C5.37258 24 0 18.6274 0 12C0 5.37258 5.37258 0 12 0C18.6274 0 24 5.37258 24 12Z" fill="#007AFF"/>
|
||||
<path d="M16.7543 10.5015C17.7125 10.5015 18.5025 9.71152 18.5025 8.74822C18.5025 7.79001 17.7125 7 16.7543 7C15.791 7 15.0061 7.79001 15.0061 8.74822C15.0061 9.71152 15.791 10.5015 16.7543 10.5015ZM11.8818 12.8308C12.1111 12.8308 12.3099 12.7187 12.5494 12.4791L14.7615 10.2773C14.4353 9.85423 14.2416 9.32416 14.2416 8.74822C14.2416 8.40673 14.3129 8.08053 14.4455 7.77982H7.71764C7.26402 7.77982 6.93782 7.86137 6.73904 8.01937L11.2141 12.4791C11.4536 12.7187 11.6524 12.8308 11.8818 12.8308ZM16.7543 9.51274C16.3364 9.51274 15.9949 9.16616 15.9949 8.74822C15.9949 8.33537 16.3364 7.98879 16.7543 7.98879C17.1672 7.98879 17.5138 8.33537 17.5138 8.74822C17.5138 9.16616 17.1672 9.51274 16.7543 9.51274ZM6.15291 16.0673L9.90418 12.3313L6.18349 8.65138C6.06116 8.83996 6 9.14577 6 9.56881V15.211C6 15.6035 6.05097 15.8889 6.15291 16.0673ZM17.6055 16.0622C17.7023 15.8838 17.7533 15.6035 17.7533 15.211V11.0469C17.4526 11.1845 17.1111 11.261 16.7543 11.261C16.2396 11.261 15.7604 11.1081 15.3629 10.8379L13.8542 12.3313L17.6055 16.0622ZM16.0408 17C16.5199 17 16.8665 16.9032 17.0805 16.7248L13.2579 12.9174L12.9827 13.1927C12.6208 13.5494 12.2691 13.7125 11.8818 13.7125C11.4944 13.7125 11.1376 13.5494 10.7808 13.1927L10.5056 12.9225L6.68807 16.7197C6.91233 16.9032 7.2844 17 7.79918 17H16.0408Z" fill="white"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.5 KiB |
@@ -59,6 +59,8 @@ class ImagePaths {
|
||||
String get icSpamV2 => _getImagePath('ic_spam_v2.svg');
|
||||
String get icMoveV2 => _getImagePath('ic_move_v2.svg');
|
||||
String get icFlagV2 => _getImagePath('ic_flag_v2.svg');
|
||||
String get icReadToast => _getImagePath('ic_read_toast.svg');
|
||||
String get icUnreadToast => _getImagePath('ic_unread_toast.svg');
|
||||
|
||||
String _getImagePath(String imageName) {
|
||||
return AssetsPaths.images + imageName;
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
import 'package:core/core.dart';
|
||||
import 'package:core/presentation/extensions/color_extension.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:fluttertoast/fluttertoast.dart';
|
||||
import 'package:getwidget/components/toast/gf_toast.dart';
|
||||
import 'package:getwidget/getwidget.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
class AppToast {
|
||||
final fToast = Get.find<FToast>();
|
||||
|
||||
void showToast(String message) {
|
||||
Fluttertoast.showToast(
|
||||
msg: message,
|
||||
@@ -55,4 +59,38 @@ class AppToast {
|
||||
toastDuration: 3
|
||||
);
|
||||
}
|
||||
|
||||
void showToastWithIcon(BuildContext context,
|
||||
{String? message, String? icon, Color? bgColor, double? radius, EdgeInsets? padding, TextStyle? textStyle}) {
|
||||
final toast = Material(
|
||||
color: bgColor ?? Colors.white,
|
||||
elevation: 10,
|
||||
shadowColor: Colors.black54,
|
||||
borderRadius: BorderRadius.all(Radius.circular(radius ?? 10)),
|
||||
child: Container(
|
||||
padding: padding ?? EdgeInsets.symmetric(horizontal: 12.0, vertical: 14),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(radius ?? 10.0),
|
||||
color: Colors.white,
|
||||
),
|
||||
width: 320,
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
if (icon != null) SvgPicture.asset(icon, width: 24, height: 24, fit: BoxFit.fill),
|
||||
SizedBox(width: 10.0),
|
||||
Expanded(child: Text(
|
||||
message ?? '',
|
||||
style: textStyle ?? TextStyle(fontSize: 15, color: Colors.black))),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
fToast.init(context);
|
||||
fToast.showToast(
|
||||
child: toast,
|
||||
gravity: ToastGravity.BOTTOM,
|
||||
toastDuration: Duration(seconds: 2),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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