diff --git a/assets/images/ic_delete_toast.svg b/assets/images/ic_delete_toast.svg
index 2c82dd270..155a9b1a0 100644
--- a/assets/images/ic_delete_toast.svg
+++ b/assets/images/ic_delete_toast.svg
@@ -1,4 +1,8 @@
diff --git a/assets/images/ic_read_toast.svg b/assets/images/ic_read_toast.svg
index ddd8057d6..d6b2a0f2a 100644
--- a/assets/images/ic_read_toast.svg
+++ b/assets/images/ic_read_toast.svg
@@ -1,4 +1,6 @@
diff --git a/assets/images/ic_send_success_toast.svg b/assets/images/ic_send_success_toast.svg
new file mode 100644
index 000000000..cfac25896
--- /dev/null
+++ b/assets/images/ic_send_success_toast.svg
@@ -0,0 +1,8 @@
+
diff --git a/assets/images/ic_toast_success_message.svg b/assets/images/ic_toast_success_message.svg
new file mode 100644
index 000000000..e5c947dfa
--- /dev/null
+++ b/assets/images/ic_toast_success_message.svg
@@ -0,0 +1,5 @@
+
diff --git a/assets/images/ic_unread_toast.svg b/assets/images/ic_unread_toast.svg
index d2d9a05ad..f6c8b3c3c 100644
--- a/assets/images/ic_unread_toast.svg
+++ b/assets/images/ic_unread_toast.svg
@@ -1,4 +1,8 @@
diff --git a/core/lib/presentation/extensions/color_extension.dart b/core/lib/presentation/extensions/color_extension.dart
index 8fd1d1f7c..93fcec29a 100644
--- a/core/lib/presentation/extensions/color_extension.dart
+++ b/core/lib/presentation/extensions/color_extension.dart
@@ -57,9 +57,8 @@ extension AppColor on Color {
static const enableSendEmailButtonColor = Color(0xFF007AFF);
static const disableSendEmailButtonColor = Color(0xFFA9B4C2);
static const borderLeftEmailContentColor = Color(0xFFEFEFEF);
- static const toastBackgroundColor = Color(0xFFACAFFF);
static const toastSuccessBackgroundColor = Color(0xFF4BB34B);
- static const toastErrorBackgroundColor = Color(0xFFFF5858);
+ static const toastErrorBackgroundColor = Color(0xFFE64646);
static const toastWithActionBackgroundColor = Color(0xFF3F3F3F);
static const buttonActionToastWithActionColor = Color(0xFF7ADCF8);
static const backgroundCountAttachment = Color(0x681C1C1C);
diff --git a/core/lib/presentation/resources/image_paths.dart b/core/lib/presentation/resources/image_paths.dart
index 7084a8f7b..b64bb10ea 100644
--- a/core/lib/presentation/resources/image_paths.dart
+++ b/core/lib/presentation/resources/image_paths.dart
@@ -49,6 +49,7 @@ class ImagePaths {
String get icFilterMessageAttachments => _getImagePath('ic_filter_message_attachments.svg');
String get icLogoTMail => _getImagePath('logo_tmail.png');
String get icSendToast => _getImagePath('ic_send_toast.svg');
+ String get icSendSuccessToast => _getImagePath('ic_send_success_toast.svg');
String get icClearTextSearch => _getImagePath('ic_clear_text_search.svg');
String get icRenameMailbox => _getImagePath('ic_rename_mailbox.svg');
String get icDeleteToast => _getImagePath('ic_delete_toast.svg');
@@ -175,6 +176,7 @@ class ImagePaths {
String get icHideMailbox => _getImagePath('ic_hide_mailbox.svg');
String get icShowMailbox => _getImagePath('ic_show_mailbox.svg');
String get icMailboxVisibility => _getImagePath('ic_mailbox_visibility.svg');
+ String get icToastSuccessMessage => _getImagePath('ic_toast_success_message.svg');
String _getImagePath(String imageName) {
return AssetsPaths.images + imageName;
diff --git a/core/lib/presentation/utils/app_toast.dart b/core/lib/presentation/utils/app_toast.dart
index 3d331d8e2..0bfe88cd1 100644
--- a/core/lib/presentation/utils/app_toast.dart
+++ b/core/lib/presentation/utils/app_toast.dart
@@ -1,79 +1,97 @@
-import 'package:core/core.dart';
+import 'package:core/presentation/extensions/color_extension.dart';
+import 'package:core/presentation/resources/image_paths.dart';
+import 'package:core/presentation/utils/responsive_utils.dart';
+import 'package:core/presentation/views/toast/tmail_toast.dart';
+import 'package:core/presentation/views/toast/toast_position.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
-import 'package:fluttertoast/fluttertoast.dart';
import 'package:get/get.dart';
import 'package:pointer_interceptor/pointer_interceptor.dart';
class AppToast {
- final fToast = Get.find();
- void showToast(String message) {
- Fluttertoast.showToast(
- msg: message,
- fontSize: 16,
- textColor: Colors.white,
- backgroundColor: AppColor.toastBackgroundColor,
- toastLength: Toast.LENGTH_SHORT,
- gravity: ToastGravity.BOTTOM);
- }
-
- void showSuccessToast(String message, {bool isToastLengthLong = false}) {
- Fluttertoast.showToast(
- msg: message,
- fontSize: 16,
- textColor: Colors.white,
- backgroundColor: AppColor.toastSuccessBackgroundColor,
- toastLength: isToastLengthLong ? Toast.LENGTH_LONG : Toast.LENGTH_SHORT,
- gravity: ToastGravity.BOTTOM);
- }
-
- void showErrorToast(String message, {bool isToastLengthLong = false}) {
- Fluttertoast.showToast(
- msg: message,
- fontSize: 16,
- textColor: Colors.white,
- backgroundColor: AppColor.toastErrorBackgroundColor,
- toastLength: isToastLengthLong ? Toast.LENGTH_LONG : Toast.LENGTH_SHORT,
- gravity: ToastGravity.BOTTOM);
- }
-
- void showBottomToast(
- BuildContext context,
- String message,
- {
- String? actionName,
- Function? onActionClick,
- Widget? actionIcon,
- Widget? leadingIcon,
- double? maxWidth,
- bool infinityToast = false,
- Color? backgroundColor,
- Color? textColor,
- Color? textActionColor,
- }
+ void showToastErrorMessage(
+ BuildContext context,
+ String message,
+ {
+ Color? leadingSVGIconColor,
+ String? leadingSVGIcon
+ }
) {
- Widget? trailingAction;
+ final imagePaths = Get.find();
+ showToastMessage(
+ context,
+ message,
+ backgroundColor: AppColor.toastErrorBackgroundColor,
+ textColor: Colors.white,
+ leadingSVGIconColor: leadingSVGIconColor ?? (leadingSVGIcon == null ? Colors.white : null),
+ leadingSVGIcon: leadingSVGIcon ?? imagePaths.icNotConnection
+ );
+ }
+ void showToastSuccessMessage(
+ BuildContext context,
+ String message,
+ {
+ Color? leadingSVGIconColor,
+ String? leadingSVGIcon,
+ }
+ ) {
+ final imagePaths = Get.find();
+ showToastMessage(
+ context,
+ message,
+ backgroundColor: AppColor.toastSuccessBackgroundColor,
+ textColor: Colors.white,
+ leadingSVGIconColor: leadingSVGIconColor ?? (leadingSVGIcon == null ? Colors.white : null),
+ leadingSVGIcon: leadingSVGIcon ?? imagePaths.icToastSuccessMessage
+ );
+ }
+
+ void showToastMessage(
+ BuildContext context,
+ String message,
+ {
+ String? actionName,
+ Function? onActionClick,
+ Widget? actionIcon,
+ Widget? leadingIcon,
+ String? leadingSVGIcon,
+ Color? leadingSVGIconColor,
+ double? maxWidth,
+ bool infinityToast = false,
+ Color? backgroundColor,
+ Color? textColor,
+ Color? textActionColor,
+ TextStyle? textStyle,
+ EdgeInsets? padding,
+ }
+ ) {
+ final responsiveUtils = Get.find();
+ Widget? trailingWidget;
if (actionName != null) {
if (actionIcon == null) {
- trailingAction = TextButton(
- onPressed: () {
- ToastView.dismiss();
- onActionClick?.call();
- },
- child: Text(
- actionName,
- style: TextStyle(
+ trailingWidget = PointerInterceptor(
+ child: TextButton(
+ onPressed: () {
+ ToastView.dismiss();
+ onActionClick?.call();
+ },
+ child: Text(
+ actionName,
+ style: TextStyle(
fontSize: 15,
fontWeight: FontWeight.normal,
- color: textActionColor ?? AppColor.buttonActionToastWithActionColor),
+ color: textActionColor ?? Colors.white
+ ),
+ ),
),
);
} else {
- trailingAction = Material(
- color: Colors.transparent,
- child: InkWell(
+ trailingWidget = PointerInterceptor(
+ child: Material(
+ color: Colors.transparent,
+ child: InkWell(
onTap: () {
ToastView.dismiss();
onActionClick?.call();
@@ -82,118 +100,58 @@ class AppToast {
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 6, horizontal: 8),
child: Row(
- mainAxisSize: MainAxisSize.min,
- children: [
- actionIcon,
- Text(
- actionName,
- style: TextStyle(
- fontSize: 15,
- fontWeight: FontWeight.normal,
- color: textActionColor ?? Colors.white),
- )
- ]
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ actionIcon,
+ Text(
+ actionName,
+ style: TextStyle(
+ fontSize: 15,
+ fontWeight: FontWeight.normal,
+ color: textActionColor ?? Colors.white
+ ),
+ )
+ ]
),
- )),
+ )
+ ),
+ ),
);
}
}
- showToastMessage(
- context,
- message,
- maxWidth: maxWidth,
- backgroundColor: backgroundColor,
- infinityToast: infinityToast,
- textColor: textColor,
- leading: leadingIcon,
- trailing: trailingAction);
- }
+ Widget? leadingWidget;
+ if (leadingIcon != null) {
+ leadingWidget = PointerInterceptor(child: leadingIcon);
+ } else {
+ if (leadingSVGIcon != null) {
+ leadingWidget = PointerInterceptor(
+ child: SvgPicture.asset(
+ leadingSVGIcon,
+ width: 24,
+ height: 24,
+ fit: BoxFit.fill,
+ colorFilter: leadingSVGIconColor?.asFilter(),
+ )
+ );
+ }
+ }
- void showToastMessage(
- BuildContext context,
- String message, {
- Color? textColor,
- Widget? leading,
- bool infinityToast = false,
- Widget? trailing,
- double? maxWidth,
- Color? backgroundColor
- }) {
TMailToast.showToast(
- message,
- context,
- width: maxWidth,
- toastPosition: ToastPosition.BOTTOM,
- textStyle: TextStyle(
- fontSize: 15,
- fontWeight: FontWeight.normal,
- color: textColor ?? Colors.white),
- backgroundColor: backgroundColor ?? AppColor.toastWithActionBackgroundColor,
- trailing: trailing != null
- ? Padding(
- padding: const EdgeInsets.only(left: 8),
- child: PointerInterceptor(child: trailing))
- : null,
- leading: leading != null
- ? Padding(
- padding: const EdgeInsets.only(right: 8),
- child: PointerInterceptor(child: leading))
- : null,
- toastBorderRadius: 10.0,
- toastDuration: infinityToast ? null : 3,
- );
- }
-
- void showToastWithIcon(
- BuildContext context, {
- String? message,
- String? icon,
- Color? bgColor,
- Color? iconColor,
- Color? textColor,
- double? radius,
- EdgeInsets? padding,
- TextStyle? textStyle,
- double? widthToast,
- Duration? toastLength
- }) async {
- double sizeWidth = context.width > 360 ? 360 : context.width - 40;
- final toast = Material(
- color: bgColor ?? Colors.white,
- elevation: 10,
- shadowColor: Colors.black54,
- borderRadius: BorderRadius.all(Radius.circular(radius ?? 10)),
- child: Container(
- padding: padding ?? const EdgeInsets.symmetric(horizontal: 12.0, vertical: 14),
- decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(radius ?? 10.0),
- color: bgColor ?? Colors.white,
- ),
- width: widthToast ?? sizeWidth,
- child: Row(
- mainAxisSize: MainAxisSize.min,
- children: [
- if (icon != null)
- SvgPicture.asset(icon,
- width: 24,
- height: 24,
- fit: BoxFit.fill,
- colorFilter: iconColor.asFilter()),
- if (icon != null)
- const SizedBox(width: 10.0),
- Expanded(child: Text(
- message ?? '',
- style: textStyle ?? TextStyle(fontSize: 15, color: textColor ?? Colors.black))),
- ],
- ),
+ message,
+ context,
+ width: maxWidth ?? responsiveUtils.getMaxWidthToast(context),
+ toastPosition: ToastPosition.BOTTOM,
+ textStyle: textStyle ?? TextStyle(
+ fontSize: 15,
+ fontWeight: FontWeight.normal,
+ color: textColor ?? AppColor.primaryColor
),
- );
- fToast.init(context);
- fToast.showToast(
- child: toast,
- gravity: ToastGravity.BOTTOM,
- toastDuration: toastLength ?? const Duration(seconds: 3),
+ backgroundColor: backgroundColor ?? Colors.white,
+ trailing: trailingWidget,
+ leading: leadingWidget,
+ padding: padding,
+ toastDuration: infinityToast ? null : 3,
);
}
}
diff --git a/core/lib/presentation/utils/responsive_utils.dart b/core/lib/presentation/utils/responsive_utils.dart
index 07da77c2e..bc010a25a 100644
--- a/core/lib/presentation/utils/responsive_utils.dart
+++ b/core/lib/presentation/utils/responsive_utils.dart
@@ -77,7 +77,7 @@ class ResponsiveUtils {
if (isPortraitMobile(context)) {
return widthScreen;
} else {
- return widthScreen < 444 ? widthScreen : 444;
+ return widthScreen < 424 ? widthScreen : 424;
}
}
diff --git a/core/lib/presentation/views/button/button_builder.dart b/core/lib/presentation/views/button/button_builder.dart
index 630854984..9d11e9975 100644
--- a/core/lib/presentation/views/button/button_builder.dart
+++ b/core/lib/presentation/views/button/button_builder.dart
@@ -18,13 +18,13 @@ class ButtonBuilder {
bool? _isVertical;
Key? _key;
Color? _iconColor;
- Color? _colorButton;
TextStyle? _textStyle;
BoxDecoration? _decoration;
Widget? _iconAction;
double? _radiusSplash;
double? _maxWidth;
EdgeInsets? _padding;
+ EdgeInsets? _margin;
String? _tooltip;
BoxConstraints? _constraints;
@@ -48,10 +48,6 @@ class ButtonBuilder {
_iconColor = color;
}
- void colorButton(Color color) {
- _colorButton = color;
- }
-
void decoration(BoxDecoration decoration) {
_decoration = decoration;
}
@@ -68,6 +64,10 @@ class ButtonBuilder {
_padding = padding;
}
+ void margin(EdgeInsets? margin) {
+ _margin = margin;
+ }
+
void textStyle(TextStyle style) {
_textStyle = style;
}
@@ -100,38 +100,40 @@ class ButtonBuilder {
}
Widget build() {
- return Material(
- color: Colors.transparent,
- child: InkWell(
- onTap: () => _onPressActionClick != null ? _onPressActionClick!.call() : null,
- onTapDown: (detail) {
- if (_onPressActionWithPositionClick != null && _context != null) {
- final screenSize = MediaQuery.of(_context!).size;
- final offset = detail.globalPosition;
- final position = RelativeRect.fromLTRB(
- offset.dx,
- offset.dy,
- screenSize.width - offset.dx,
- screenSize.height - offset.dy,
- );
- _onPressActionWithPositionClick?.call(position);
- }
- },
- customBorder: RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(_radiusSplash ?? 20)),
- child: Tooltip(
- message: _tooltip ?? '',
- child: Container(
- key: _key,
- alignment: Alignment.center,
- color: _decoration == null ? _colorButton : null,
- decoration: _decoration,
- width: _maxWidth,
- constraints: _constraints,
- padding: _padding ?? EdgeInsets.zero,
- child: _buildBody()
- ),
- )
+ return Padding(
+ padding: _margin ?? EdgeInsets.zero,
+ child: Material(
+ color: Colors.transparent,
+ child: InkWell(
+ onTap: _onPressActionClick,
+ onTapDown: (detail) {
+ if (_onPressActionWithPositionClick != null && _context != null) {
+ final screenSize = MediaQuery.of(_context!).size;
+ final offset = detail.globalPosition;
+ final position = RelativeRect.fromLTRB(
+ offset.dx,
+ offset.dy,
+ screenSize.width - offset.dx,
+ screenSize.height - offset.dy,
+ );
+ _onPressActionWithPositionClick?.call(position);
+ }
+ },
+ borderRadius: BorderRadius.circular(_radiusSplash ?? 20),
+ child: Tooltip(
+ message: _tooltip ?? '',
+ child: Container(
+ key: _key,
+ alignment: Alignment.center,
+ color: _decoration == null ? Colors.transparent : null,
+ decoration: _decoration,
+ width: _maxWidth,
+ constraints: _constraints,
+ padding: _padding ?? EdgeInsets.zero,
+ child: _buildBody()
+ ),
+ )
+ ),
),
);
}
@@ -163,11 +165,12 @@ class ButtonBuilder {
Widget _buildIcon() => Padding(
padding: _paddingIcon ?? const EdgeInsets.all(10),
child: SvgPicture.asset(
- _icon ?? '',
- width: _size ?? 24,
- height: _size ?? 24,
- fit: BoxFit.fill,
- colorFilter: _iconColor.asFilter()));
+ _icon ?? '',
+ width: _size ?? 24,
+ height: _size ?? 24,
+ fit: BoxFit.fill,
+ colorFilter: _iconColor.asFilter()
+ ));
Widget _buildText() {
return Text(
@@ -176,8 +179,9 @@ class ButtonBuilder {
softWrap: CommonTextStyle.defaultSoftWrap,
overflow: CommonTextStyle.defaultTextOverFlow,
style: _textStyle ?? const TextStyle(
- fontSize: 12,
- color: AppColor.colorTextButton),
+ fontSize: 12,
+ color: AppColor.colorTextButton
+ ),
);
}
}
\ No newline at end of file
diff --git a/core/lib/presentation/views/toast/tmail_toast.dart b/core/lib/presentation/views/toast/tmail_toast.dart
index 0a30b44cf..ab43ffee1 100644
--- a/core/lib/presentation/views/toast/tmail_toast.dart
+++ b/core/lib/presentation/views/toast/tmail_toast.dart
@@ -1,5 +1,6 @@
import 'dart:async';
+import 'package:core/presentation/extensions/color_extension.dart';
import 'package:core/presentation/views/toast/toast_position.dart';
import 'package:flutter/material.dart';
@@ -34,52 +35,68 @@ class TMailToast {
/// defines the size width widget of the toast
double? width;
- // ignore: type_annotate_public_apis, always_declare_return_types
+ /// defines the padding widget of the toast
+ EdgeInsets? padding;
+
static showToast(
text,
BuildContext context, {
toastDuration,
toastPosition,
- backgroundColor = const Color(0xAA000000),
- textStyle = const TextStyle(fontSize: 15, color: Colors.white),
- toastBorderRadius = 20.0,
+ backgroundColor,
+ textStyle = const TextStyle(
+ fontSize: 15,
+ color: Colors.white,
+ fontWeight: FontWeight.normal
+ ),
+ toastBorderRadius = 10.0,
border,
trailing,
leading,
width,
+ padding,
}) {
assert(text != null);
ToastView.dismiss();
- ToastView.createView(text, context, toastPosition,
- backgroundColor, textStyle, toastBorderRadius, border, trailing,
- leading, width, toastDuration: toastDuration,);
+ ToastView.createView(
+ text,
+ context,
+ toastPosition,
+ backgroundColor,
+ textStyle,
+ toastBorderRadius,
+ border,
+ trailing,
+ leading,
+ width,
+ padding,
+ toastDuration: toastDuration,
+ );
}
}
class ToastView {
static final ToastView _instance = ToastView._internal();
- // ignore: sort_constructors_first
factory ToastView() => _instance;
- // ignore: sort_constructors_first
ToastView._internal();
static OverlayState? overlayState;
static OverlayEntry? _overlayEntry;
static bool _isVisible = false;
- // ignore: avoid_void_async
static void createView(
String text,
BuildContext context,
ToastPosition? toastPosition,
- Color backgroundColor,
- TextStyle textStyle,
+ Color? backgroundColor,
+ TextStyle? textStyle,
double toastBorderRadius,
Border? border,
Widget? trailing,
Widget? leading,
double? width,
- {int? toastDuration = 2}
+ EdgeInsets? padding,
+ {int? toastDuration}
) async {
overlayState = Overlay.of(context, rootOverlay: false);
@@ -89,49 +106,72 @@ class ToastView {
child: Container(
width: width,
decoration: BoxDecoration(
- color: backgroundColor,
+ color: backgroundColor ?? Colors.white,
borderRadius: BorderRadius.circular(toastBorderRadius),
border: border,
+ boxShadow: const [
+ BoxShadow(
+ color: AppColor.colorShadowLayerBottom,
+ blurRadius: 24,
+ offset: Offset.zero),
+ BoxShadow(
+ color: AppColor.colorShadowBgContentEmail,
+ blurRadius: 2,
+ offset: Offset.zero),
+ ]
),
margin: const EdgeInsets.symmetric(horizontal: 16),
- padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 16),
- child: trailing == null && leading == null ?
- Text(text, softWrap: true, style: textStyle) :
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- if (leading != null) leading,
- Expanded(child: Text(text, style: textStyle)),
- if (trailing != null) trailing
- ],
- ),
+ padding: padding ?? const EdgeInsets.all(12),
+ child: trailing == null && leading == null
+ ? Text(
+ text,
+ softWrap: true,
+ style: textStyle ?? const TextStyle(
+ fontSize: 15,
+ color: Colors.white,
+ fontWeight: FontWeight.normal
+ )
+ )
+ : Row(
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ children: [
+ if (leading != null) leading,
+ Expanded(child: Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 12),
+ child: Text(
+ text,
+ style: textStyle ?? const TextStyle(
+ fontSize: 15,
+ color: Colors.white,
+ fontWeight: FontWeight.normal
+ )
+ )
+ )),
+ if (trailing != null) trailing
+ ],
+ ),
),
),
);
- _overlayEntry = OverlayEntry(
- builder: (BuildContext context) =>
- _showWidgetBasedOnPosition(
- toastDuration != null ?
- ToastCard(
- child,
- Duration(seconds: toastDuration),
- fadeDuration: 500,
- )
- : child, toastPosition,
- ));
+ _overlayEntry = OverlayEntry(builder: (context) =>
+ _showWidgetBasedOnPosition(
+ toastDuration != null
+ ? ToastCard(child, Duration(seconds: toastDuration))
+ : child,
+ toastPosition,
+ )
+ );
_isVisible = true;
overlayState!.insert(_overlayEntry!);
- if (toastDuration != null) {
- await Future.delayed(Duration(seconds: toastDuration));
- await dismiss();
- }
}
static Positioned _showWidgetBasedOnPosition(
- Widget child, ToastPosition? toastPosition) {
+ Widget child,
+ ToastPosition? toastPosition
+ ) {
switch (toastPosition) {
case ToastPosition.BOTTOM:
return Positioned(bottom: 60, left: 18, right: 18, child: child);
@@ -140,8 +180,7 @@ class ToastView {
case ToastPosition.BOTTOM_RIGHT:
return Positioned(bottom: 60, right: 18, child: child);
case ToastPosition.CENTER:
- return Positioned(
- top: 60, bottom: 60, left: 18, right: 18, child: child);
+ return Positioned(top: 60, bottom: 60, left: 18, right: 18, child: child);
case ToastPosition.CENTER_LEFT:
return Positioned(top: 60, bottom: 60, left: 18, child: child);
case ToastPosition.CENTER_RIGHT:
@@ -165,9 +204,14 @@ class ToastView {
}
class ToastCard extends StatefulWidget {
- const ToastCard(this.child, this.duration,
- {Key? key, this.fadeDuration = 500})
- : super(key: key);
+ const ToastCard(
+ this.child,
+ this.duration,
+ {
+ Key? key,
+ this.fadeDuration = 300
+ }
+ ) : super(key: key);
final Widget child;
final Duration duration;
@@ -199,8 +243,7 @@ class ToastStateFulState extends State
vsync: this,
duration: Duration(milliseconds: widget.fadeDuration),
);
- _fadeAnimation =
- CurvedAnimation(parent: _animationController!, curve: Curves.easeIn);
+ _fadeAnimation = CurvedAnimation(parent: _animationController!, curve: Curves.easeIn);
super.initState();
showAnimation();
@@ -226,4 +269,4 @@ class ToastStateFulState extends State
opacity: _fadeAnimation as Animation,
child: widget.child,
);
-}
+}
\ No newline at end of file
diff --git a/lib/features/base/base_controller.dart b/lib/features/base/base_controller.dart
index dc400f21c..f5d191f3f 100644
--- a/lib/features/base/base_controller.dart
+++ b/lib/features/base/base_controller.dart
@@ -1,18 +1,13 @@
import 'package:contact/contact/model/capability_contact.dart';
-import 'package:core/presentation/extensions/color_extension.dart';
-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:core/utils/build_utils.dart';
import 'package:core/utils/fps_manager.dart';
import 'package:dartz/dartz.dart';
import 'package:fcm/model/firebase_capability.dart';
-import 'package:flutter/material.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
-import 'package:flutter_svg/flutter_svg.dart';
import 'package:forward/forward/capability_forward.dart';
import 'package:get/get.dart';
import 'package:jmap_dart_client/jmap/account_id.dart';
@@ -77,7 +72,6 @@ abstract class BaseController extends GetxController
final AppToast _appToast = Get.find();
-
final viewState = Rx>(Right(UIState.idle));
FpsCallback? fpsCallback;
@@ -137,7 +131,12 @@ abstract class BaseController extends GetxController
if (failure.exception is NoNetworkError) {
return true;
} else if (failure.exception is BadCredentialsException) {
- _appToast.showErrorToast(AppLocalizations.of(currentContext!).badCredentials);
+ if (currentOverlayContext != null && currentContext != null) {
+ _appToast.showToastErrorMessage(
+ currentOverlayContext!,
+ AppLocalizations.of(currentContext!).badCredentials);
+ }
+
checkAuthenticationTypeWhenLogout();
return true;
}
@@ -152,8 +151,6 @@ abstract class BaseController extends GetxController
}
final appToast = Get.find();
- final imagePaths = Get.find();
- final responsiveUtils = Get.find();
String messageError = '';
if (error is MethodLevelErrors) {
@@ -165,19 +162,7 @@ abstract class BaseController extends GetxController
}
if (messageError.isNotEmpty && currentContext != null && currentOverlayContext != null) {
- appToast.showBottomToast(
- currentOverlayContext!,
- messageError,
- 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(currentContext!));
+ appToast.showToastErrorMessage(currentOverlayContext!, messageError);
}
}
@@ -262,18 +247,18 @@ abstract class BaseController extends GetxController
}
bool fcmEnabled(Session? session, AccountId? accountId) {
- bool _fcmEnabled = false;
+ bool fcmEnabled = false;
try {
requireCapability(session!, accountId!, [FirebaseCapability.fcmIdentifier]);
if (AppConfig.fcmAvailable) {
- _fcmEnabled = true;
+ fcmEnabled = true;
} else {
- _fcmEnabled = false;
+ fcmEnabled = false;
}
} catch (e) {
logError('BaseController::fcmEnabled(): exception: $e');
}
- return _fcmEnabled;
+ return fcmEnabled;
}
void goToLogin({LoginArguments? arguments}) {
diff --git a/lib/features/base/mixin/date_range_picker_mixin.dart b/lib/features/base/mixin/date_range_picker_mixin.dart
index 8886eed3c..ab6b809a9 100644
--- a/lib/features/base/mixin/date_range_picker_mixin.dart
+++ b/lib/features/base/mixin/date_range_picker_mixin.dart
@@ -1,5 +1,4 @@
-import 'package:core/presentation/resources/image_paths.dart';
import 'package:core/presentation/utils/app_toast.dart';
import 'package:flutter/material.dart';
import 'package:flutter_date_range_picker/multiple_view_date_range_picker.dart';
@@ -54,36 +53,26 @@ mixin DateRangePickerMixin {
DateTime? endDate,
{Function(DateTime? startDate, DateTime? endDate)? onCallbackAction}
) {
- final _appToast = Get.find();
- final _imagePaths = Get.find();
+ final appToast = Get.find();
if (startDate == null) {
- _appToast.showToastWithIcon(
+ appToast.showToastErrorMessage(
context,
- textColor: Colors.black,
- message: AppLocalizations.of(context).toastMessageErrorWhenSelectStartDateIsEmpty,
- icon: _imagePaths.icNotConnection
- );
+ AppLocalizations.of(context).toastMessageErrorWhenSelectStartDateIsEmpty);
return;
}
if (endDate == null) {
- _appToast.showToastWithIcon(
+ appToast.showToastErrorMessage(
context,
- textColor: Colors.black,
- message: AppLocalizations.of(context).toastMessageErrorWhenSelectEndDateIsEmpty,
- icon: _imagePaths.icNotConnection
- );
+ AppLocalizations.of(context).toastMessageErrorWhenSelectEndDateIsEmpty);
return;
}
if (endDate.isBefore(startDate)) {
- _appToast.showToastWithIcon(
+ appToast.showToastErrorMessage(
context,
- textColor: Colors.black,
- message: AppLocalizations.of(context).toastMessageErrorWhenSelectDateIsInValid,
- icon: _imagePaths.icNotConnection
- );
+ AppLocalizations.of(context).toastMessageErrorWhenSelectDateIsInValid);
return;
}
diff --git a/lib/features/composer/presentation/composer_controller.dart b/lib/features/composer/presentation/composer_controller.dart
index 534bd706f..c4a44251d 100644
--- a/lib/features/composer/presentation/composer_controller.dart
+++ b/lib/features/composer/presentation/composer_controller.dart
@@ -872,8 +872,10 @@ class ComposerController extends BaseController {
void _pickFileFailure(Failure failure) {
if (failure is LocalFilePickerFailure) {
- if (currentContext != null) {
- _appToast.showErrorToast(AppLocalizations.of(currentContext!).can_not_upload_this_file_as_attachments);
+ if (currentOverlayContext != null && currentContext != null) {
+ _appToast.showToastErrorMessage(
+ currentOverlayContext!,
+ AppLocalizations.of(currentContext!).can_not_upload_this_file_as_attachments);
}
}
}
diff --git a/lib/features/destination_picker/presentation/destination_picker_controller.dart b/lib/features/destination_picker/presentation/destination_picker_controller.dart
index c6bff2601..0713bb908 100644
--- a/lib/features/destination_picker/presentation/destination_picker_controller.dart
+++ b/lib/features/destination_picker/presentation/destination_picker_controller.dart
@@ -1,14 +1,10 @@
-import 'package:core/presentation/extensions/color_extension.dart';
-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/build_utils.dart';
import 'package:dartz/dartz.dart';
import 'package:flutter/material.dart';
-import 'package:flutter_svg/flutter_svg.dart';
import 'package:get/get.dart';
import 'package:jmap_dart_client/jmap/account_id.dart';
import 'package:jmap_dart_client/jmap/core/error/method/error_method_response.dart';
@@ -51,8 +47,6 @@ class DestinationPickerController extends BaseMailboxController {
final _uuid = Get.find();
final _appToast = Get.find();
- final _imagePaths = Get.find();
- final _responsiveUtils = Get.find();
final SearchMailboxInteractor _searchMailboxInteractor;
final CreateNewMailboxInteractor _createNewMailboxInteractor;
@@ -318,19 +312,9 @@ class DestinationPickerController extends BaseMailboxController {
void openCreateNewMailboxView(BuildContext context) async {
if (mailboxDestination.value == null) {
- _appToast.showBottomToast(
+ _appToast.showToastErrorMessage(
currentOverlayContext!,
- AppLocalizations.of(context).toastMessageErrorNotSelectedFolderWhenCreateNewMailbox,
- 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(currentContext!));
+ AppLocalizations.of(context).toastMessageErrorNotSelectedFolderWhenCreateNewMailbox);
} else {
destinationScreenType.value = DestinationScreenType.createNewMailbox;
_createListMailboxNameAsStringInMailboxLocation();
@@ -363,20 +347,7 @@ class DestinationPickerController extends BaseMailboxController {
if (exception is ErrorMethodResponse) {
messageError = exception.description ?? AppLocalizations.of(currentContext!).create_new_mailbox_failure;
}
-
- _appToast.showBottomToast(
- currentOverlayContext!,
- messageError,
- 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(currentContext!));
+ _appToast.showToastErrorMessage(currentOverlayContext!, messageError);
}
}
@@ -409,19 +380,9 @@ class DestinationPickerController extends BaseMailboxController {
FocusScope.of(context).unfocus();
if (mailboxDestination.value == null) {
- _appToast.showBottomToast(
- currentOverlayContext!,
- AppLocalizations.of(context).toastMessageErrorNotSelectedFolderWhenCreateNewMailbox,
- 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(currentContext!));
+ _appToast.showToastErrorMessage(
+ currentOverlayContext!,
+ AppLocalizations.of(context).toastMessageErrorNotSelectedFolderWhenCreateNewMailbox);
return;
}
diff --git a/lib/features/email/presentation/controller/single_email_controller.dart b/lib/features/email/presentation/controller/single_email_controller.dart
index 9d9585a92..2942aa74b 100644
--- a/lib/features/email/presentation/controller/single_email_controller.dart
+++ b/lib/features/email/presentation/controller/single_email_controller.dart
@@ -212,11 +212,12 @@ class SingleEmailController extends BaseController with AppLoaderMixin {
taskId: success.taskId,
attachment: success.attachment));
- if (currentOverlayContext != null && currentContext != null) {
- _appToast.showToastWithIcon(currentOverlayContext!,
- message: AppLocalizations.of(currentContext!).your_download_has_started,
- iconColor: AppColor.primaryColor,
- icon: imagePaths.icDownload);
+ if (currentOverlayContext != null && currentContext != null) {
+ _appToast.showToastMessage(
+ currentOverlayContext!,
+ AppLocalizations.of(currentContext!).your_download_has_started,
+ leadingSVGIconColor: AppColor.primaryColor,
+ leadingSVGIcon: imagePaths.icDownload);
}
} else if (success is DownloadingAttachmentForWeb) {
final percent = success.progress.round();
@@ -445,8 +446,11 @@ class SingleEmailController extends BaseController with AppLoaderMixin {
_downloadAttachmentsAction(attachments);
break;
case PermissionStatus.permanentlyDenied:
- if (context.mounted) {
- _appToast.showToast(AppLocalizations.of(context).you_need_to_grant_files_permission_to_download_attachments);
+ if (context.mounted && currentOverlayContext != null && currentContext != null) {
+ _appToast.showToastMessage(
+ currentOverlayContext!,
+ AppLocalizations.of(context).you_need_to_grant_files_permission_to_download_attachments,
+ );
}
break;
default: {
@@ -456,8 +460,11 @@ class SingleEmailController extends BaseController with AppLoaderMixin {
_downloadAttachmentsAction(attachments);
break;
default:
- if (context.mounted) {
- _appToast.showToast(AppLocalizations.of(context).you_need_to_grant_files_permission_to_download_attachments);
+ if (context.mounted && currentOverlayContext != null && currentContext != null) {
+ _appToast.showToastMessage(
+ currentOverlayContext!,
+ AppLocalizations.of(context).you_need_to_grant_files_permission_to_download_attachments,
+ );
}
break;
}
@@ -477,8 +484,10 @@ class SingleEmailController extends BaseController with AppLoaderMixin {
}
void _downloadAttachmentsFailure(DownloadAttachmentsFailure failure) {
- if (currentContext != null) {
- _appToast.showErrorToast(AppLocalizations.of(currentContext!).attachment_download_failed);
+ if (currentOverlayContext != null && currentContext != null) {
+ _appToast.showToastErrorMessage(
+ currentOverlayContext!,
+ AppLocalizations.of(currentContext!).attachment_download_failed);
}
}
@@ -526,8 +535,11 @@ class SingleEmailController extends BaseController with AppLoaderMixin {
void _exportAttachmentFailureAction(ExportAttachmentFailure failure) {
if (failure.exception is! CancelDownloadFileException) {
popBack();
- if (currentContext != null) {
- _appToast.showErrorToast(AppLocalizations.of(currentContext!).attachment_download_failed);
+
+ if (currentOverlayContext != null && currentContext != null) {
+ _appToast.showToastErrorMessage(
+ currentOverlayContext!,
+ AppLocalizations.of(currentContext!).attachment_download_failed);
}
}
}
@@ -550,8 +562,10 @@ class SingleEmailController extends BaseController with AppLoaderMixin {
if (openResult.type != open_file.ResultType.done) {
logError('SingleEmailController::_openDownloadedPreviewWorkGroupDocument(): no preview available');
- if (currentContext != null) {
- _appToast.showErrorToast(AppLocalizations.of(currentContext!).noPreviewAvailable);
+ if (currentOverlayContext != null && currentContext != null) {
+ _appToast.showToastErrorMessage(
+ currentOverlayContext!,
+ AppLocalizations.of(currentContext!).noPreviewAvailable);
}
}
}
@@ -587,13 +601,10 @@ class SingleEmailController extends BaseController with AppLoaderMixin {
log('SingleEmailController::_downloadAttachmentForWebFailureAction(): $failure');
mailboxDashBoardController.deleteDownloadTask(failure.taskId);
- if (currentOverlayContext != null && currentContext != null) {
- _appToast.showToastWithIcon(currentOverlayContext!,
- message: AppLocalizations.of(currentContext!).attachment_download_failed,
- bgColor: AppColor.toastErrorBackgroundColor,
- textColor: Colors.white,
- iconColor: Colors.white,
- icon: imagePaths.icDownload);
+ if (currentOverlayContext != null && currentContext != null) {
+ _appToast.showToastErrorMessage(
+ currentOverlayContext!,
+ AppLocalizations.of(currentContext!).attachment_download_failed);
}
}
@@ -682,7 +693,7 @@ class SingleEmailController extends BaseController with AppLoaderMixin {
void _moveToMailboxSuccess(MoveToMailboxSuccess success) {
mailboxDashBoardController.dispatchState(Right(success));
if (success.moveAction == MoveAction.moving && currentContext != null && currentOverlayContext != null) {
- _appToast.showBottomToast(
+ _appToast.showToastMessage(
currentOverlayContext!,
success.emailActionType.getToastMessageMoveToMailboxSuccess(currentContext!, destinationPath: success.destinationPath),
actionName: AppLocalizations.of(currentContext!).undo,
@@ -694,17 +705,11 @@ class SingleEmailController extends BaseController with AppLoaderMixin {
mailboxDashBoardController.sessionCurrent!,
success.emailActionType));
},
- leadingIcon: SvgPicture.asset(
- imagePaths.icFolderMailbox,
- width: 24,
- height: 24,
- colorFilter: const ColorFilter.mode(Colors.white, BlendMode.srcIn),
- fit: BoxFit.fill),
+ leadingSVGIcon: imagePaths.icFolderMailbox,
+ leadingSVGIconColor: Colors.white,
backgroundColor: AppColor.toastSuccessBackgroundColor,
textColor: Colors.white,
- textActionColor: Colors.white,
- actionIcon: SvgPicture.asset(imagePaths.icUndo),
- maxWidth: responsiveUtils.getMaxWidthToast(currentContext!)
+ actionIcon: SvgPicture.asset(imagePaths.icUndo)
);
}
}
@@ -931,53 +936,23 @@ class SingleEmailController extends BaseController with AppLoaderMixin {
}
if (_sendReceiptToSenderInteractor == null) {
- _appToast.showBottomToast(
- currentOverlayContext!,
- AppLocalizations.of(context).toastMessageNotSupportMdnWhenSendReceipt,
- leadingIcon: SvgPicture.asset(
- imagePaths.icNotConnection,
- width: 24,
- height: 24,
- colorFilter: const ColorFilter.mode(Colors.white, BlendMode.srcIn),
- fit: BoxFit.fill),
- backgroundColor: AppColor.toastErrorBackgroundColor,
- textColor: Colors.white,
- textActionColor: Colors.white,
- maxWidth: responsiveUtils.getMaxWidthToast(currentContext!));
+ _appToast.showToastErrorMessage(
+ currentOverlayContext!,
+ AppLocalizations.of(context).toastMessageNotSupportMdnWhenSendReceipt);
return;
}
if (_identitySelected == null || _identitySelected?.id == null) {
- _appToast.showBottomToast(
- currentOverlayContext!,
- AppLocalizations.of(context).toastMessageCannotFoundIdentityWhenSendReceipt,
- leadingIcon: SvgPicture.asset(
- imagePaths.icNotConnection,
- width: 24,
- height: 24,
- colorFilter: const ColorFilter.mode(Colors.white, BlendMode.srcIn),
- fit: BoxFit.fill),
- backgroundColor: AppColor.toastErrorBackgroundColor,
- textColor: Colors.white,
- textActionColor: Colors.white,
- maxWidth: responsiveUtils.getMaxWidthToast(currentContext!));
+ _appToast.showToastErrorMessage(
+ currentOverlayContext!,
+ AppLocalizations.of(context).toastMessageCannotFoundIdentityWhenSendReceipt);
return;
}
if (currentEmail == null || _currentEmailId == null) {
- _appToast.showBottomToast(
- currentOverlayContext!,
- AppLocalizations.of(context).toastMessageCannotFoundEmailIdWhenSendReceipt,
- leadingIcon: SvgPicture.asset(
- imagePaths.icNotConnection,
- width: 24,
- height: 24,
- colorFilter: const ColorFilter.mode(Colors.white, BlendMode.srcIn),
- fit: BoxFit.fill),
- backgroundColor: AppColor.toastErrorBackgroundColor,
- textColor: Colors.white,
- textActionColor: Colors.white,
- maxWidth: responsiveUtils.getMaxWidthToast(currentContext!));
+ _appToast.showToastErrorMessage(
+ currentOverlayContext!,
+ AppLocalizations.of(context).toastMessageCannotFoundEmailIdWhenSendReceipt);
return;
}
@@ -1027,18 +1002,10 @@ class SingleEmailController extends BaseController with AppLoaderMixin {
void _sendReceiptToSenderSuccess(SendReceiptToSenderSuccess success) {
log('SingleEmailController::_sendReceiptToSenderSuccess(): ${success.mdn.toString()}');
if (currentContext != null) {
- _appToast.showBottomToast(
- currentOverlayContext!,
- AppLocalizations.of(currentContext!).toastMessageSendReceiptSuccess,
- leadingIcon: SvgPicture.asset(
- imagePaths.icReadReceiptMessage,
- width: 24,
- height: 24,
- fit: BoxFit.fill),
- backgroundColor: AppColor.toastSuccessBackgroundColor,
- textColor: Colors.white,
- textActionColor: Colors.white,
- maxWidth: responsiveUtils.getMaxWidthToast(currentContext!));
+ _appToast.showToastSuccessMessage(
+ currentOverlayContext!,
+ AppLocalizations.of(currentContext!).toastMessageSendReceiptSuccess,
+ leadingSVGIcon: imagePaths.icReadReceiptMessage);
}
}
@@ -1152,10 +1119,9 @@ class SingleEmailController extends BaseController with AppLoaderMixin {
void _createNewRuleFilterSuccess(CreateNewRuleFilterSuccess success) {
if (success.newListRules.isNotEmpty == true) {
if (currentOverlayContext != null && currentContext != null) {
- _appToast.showToastWithIcon(
+ _appToast.showToastSuccessMessage(
currentOverlayContext!,
- message: AppLocalizations.of(currentContext!).newFilterWasCreated,
- icon: imagePaths.icSelected);
+ AppLocalizations.of(currentContext!).newFilterWasCreated);
}
}
}
diff --git a/lib/features/mailbox/presentation/mailbox_controller.dart b/lib/features/mailbox/presentation/mailbox_controller.dart
index 95402e4e0..f320f951d 100644
--- a/lib/features/mailbox/presentation/mailbox_controller.dart
+++ b/lib/features/mailbox/presentation/mailbox_controller.dart
@@ -509,19 +509,11 @@ class MailboxController extends BaseMailboxController with MailboxActionHandlerM
void _createNewMailboxSuccess(CreateNewMailboxSuccess success) {
if (currentOverlayContext != null && currentContext != null) {
- _appToast.showBottomToast(
- currentOverlayContext!,
- AppLocalizations.of(currentContext!).new_mailbox_is_created(success.newMailbox.name?.name ?? ''),
- 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,
- maxWidth: _responsiveUtils.getMaxWidthToast(currentContext!));
+ _appToast.showToastSuccessMessage(
+ currentOverlayContext!,
+ AppLocalizations.of(currentContext!).new_mailbox_is_created(success.newMailbox.name?.name ?? ''),
+ leadingSVGIconColor: Colors.white,
+ leadingSVGIcon: _imagePaths.icFolderMailbox);
}
_refreshMailboxChanges(currentMailboxState: success.currentMailboxState);
@@ -534,20 +526,7 @@ class MailboxController extends BaseMailboxController with MailboxActionHandlerM
if (exception is ErrorMethodResponse) {
messageError = exception.description ?? AppLocalizations.of(currentContext!).create_new_mailbox_failure;
}
-
- _appToast.showBottomToast(
- currentOverlayContext!,
- messageError,
- 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(currentContext!));
+ _appToast.showToastErrorMessage(currentOverlayContext!, messageError);
}
}
@@ -685,11 +664,11 @@ class MailboxController extends BaseMailboxController with MailboxActionHandlerM
jmap.State? currentMailboxState
) {
if (currentOverlayContext != null && currentContext != null) {
- _appToast.showToastWithIcon(
- currentOverlayContext!,
- message: AppLocalizations.of(currentContext!).delete_mailboxes_successfully,
- icon: _imagePaths.icSelected);
+ _appToast.showToastSuccessMessage(
+ currentOverlayContext!,
+ AppLocalizations.of(currentContext!).delete_mailboxes_successfully);
}
+
if (listMailboxIdDeleted.contains(selectedMailbox?.id)) {
_switchBackToMailboxDefault();
_closeEmailViewIfMailboxDisabledOrNotExist(listMailboxIdDeleted);
@@ -772,10 +751,11 @@ class MailboxController extends BaseMailboxController with MailboxActionHandlerM
void _deleteMailboxFailure(DeleteMultipleMailboxFailure failure) {
if (currentOverlayContext != null && currentContext != null) {
- _appToast.showToastWithIcon(
- currentOverlayContext!,
- message: AppLocalizations.of(currentContext!).delete_mailboxes_failure,
- icon: _imagePaths.icDeleteToast);
+ _appToast.showToastErrorMessage(
+ currentOverlayContext!,
+ AppLocalizations.of(currentContext!).delete_mailboxes_failure,
+ leadingSVGIcon: _imagePaths.icDeleteToast
+ );
}
}
@@ -810,7 +790,7 @@ class MailboxController extends BaseMailboxController with MailboxActionHandlerM
if (success.moveAction == MoveAction.moving
&& currentOverlayContext != null
&& currentContext != null) {
- _appToast.showBottomToast(
+ _appToast.showToastMessage(
currentOverlayContext!,
AppLocalizations.of(currentContext!).moved_to_mailbox(
success.destinationMailboxName?.name ?? AppLocalizations.of(currentContext!).allMailboxes),
@@ -822,17 +802,11 @@ class MailboxController extends BaseMailboxController with MailboxActionHandlerM
destinationMailboxId: success.parentId,
parentId: success.destinationMailboxId));
},
- leadingIcon: SvgPicture.asset(
- _imagePaths.icFolderMailbox,
- width: 24,
- height: 24,
- colorFilter: Colors.white.asFilter(),
- fit: BoxFit.fill),
+ leadingSVGIcon: _imagePaths.icFolderMailbox,
+ leadingSVGIconColor: Colors.white,
backgroundColor: AppColor.toastSuccessBackgroundColor,
textColor: Colors.white,
- textActionColor: Colors.white,
- actionIcon: SvgPicture.asset(_imagePaths.icUndo),
- maxWidth: _responsiveUtils.getMaxWidthToast(currentContext!));
+ actionIcon: SvgPicture.asset(_imagePaths.icUndo));
}
_refreshMailboxChanges(currentMailboxState: success.currentMailboxState);
@@ -1106,7 +1080,7 @@ class MailboxController extends BaseMailboxController with MailboxActionHandlerM
{List? listDescendantMailboxIds}
) {
if (currentOverlayContext != null && currentContext != null) {
- _appToast.showBottomToast(
+ _appToast.showToastMessage(
currentOverlayContext!,
AppLocalizations.of(currentContext!).toastMsgHideMailboxSuccess,
actionName: AppLocalizations.of(currentContext!).undo,
@@ -1114,19 +1088,11 @@ class MailboxController extends BaseMailboxController with MailboxActionHandlerM
mailboxIdSubscribed,
listDescendantMailboxIds: listDescendantMailboxIds
),
- leadingIcon: SvgPicture.asset(
- _imagePaths.icFolderMailbox,
- width: 24,
- height: 24,
- colorFilter: Colors.white.asFilter(),
- fit: BoxFit.fill
- ),
+ leadingSVGIcon: _imagePaths.icFolderMailbox,
+ leadingSVGIconColor: Colors.white,
backgroundColor: AppColor.toastSuccessBackgroundColor,
textColor: Colors.white,
- textActionColor: Colors.white,
- actionIcon: SvgPicture.asset(_imagePaths.icUndo),
- maxWidth: _responsiveUtils.getMaxWidthToast(currentContext!)
- );
+ actionIcon: SvgPicture.asset(_imagePaths.icUndo));
}
}
diff --git a/lib/features/mailbox/presentation/widgets/bottom_bar_selection_mailbox_widget.dart b/lib/features/mailbox/presentation/widgets/bottom_bar_selection_mailbox_widget.dart
index 2d8dbecfd..e12ae8f76 100644
--- a/lib/features/mailbox/presentation/widgets/bottom_bar_selection_mailbox_widget.dart
+++ b/lib/features/mailbox/presentation/widgets/bottom_bar_selection_mailbox_widget.dart
@@ -37,7 +37,6 @@ class BottomBarSelectionMailboxWidget extends StatelessWidget {
Widget _buildMailboxActionButton(BuildContext context, MailboxActions actions) {
return Expanded(child: (ButtonBuilder(actions.getContextMenuIcon(_imagePaths))
- ..key(const Key('button_move_all_mailbox'))
..radiusSplash(8)
..padding(const EdgeInsets.all(8))
..tooltip(actions.getTitleContextMenu(context))
diff --git a/lib/features/mailbox_dashboard/presentation/controller/mailbox_dashboard_controller.dart b/lib/features/mailbox_dashboard/presentation/controller/mailbox_dashboard_controller.dart
index a5ed2b914..a99b3b38f 100644
--- a/lib/features/mailbox_dashboard/presentation/controller/mailbox_dashboard_controller.dart
+++ b/lib/features/mailbox_dashboard/presentation/controller/mailbox_dashboard_controller.dart
@@ -262,10 +262,10 @@ class MailboxDashBoardController extends ReloadableController {
log('MailboxDashBoardController::onData():success $success');
if (success is SendingEmailState) {
if (currentOverlayContext != null && currentContext != null) {
- _appToast.showToastWithIcon(
- currentOverlayContext!,
- message: AppLocalizations.of(currentContext!).your_email_being_sent,
- icon: _imagePaths.icSendToast,
+ _appToast.showToastMessage(
+ currentOverlayContext!,
+ AppLocalizations.of(currentContext!).your_email_being_sent,
+ leadingSVGIcon: _imagePaths.icSendToast
);
}
} else if (success is GetEmailStateToRefreshSuccess) {
@@ -301,11 +301,10 @@ class MailboxDashBoardController extends ReloadableController {
(success) {
if (success is SendEmailSuccess) {
if (currentOverlayContext != null && currentContext != null) {
- _appToast.showToastWithIcon(
- currentOverlayContext!,
- textColor: AppColor.primaryColor,
- message: AppLocalizations.of(currentContext!).message_has_been_sent_successfully,
- icon: _imagePaths.icSendToast);
+ _appToast.showToastSuccessMessage(
+ currentOverlayContext!,
+ AppLocalizations.of(currentContext!).message_has_been_sent_successfully,
+ leadingSVGIcon: _imagePaths.icSendSuccessToast);
}
} else if (success is SaveEmailAsDraftsSuccess) {
log('MailboxDashBoardController::onDone(): SaveEmailAsDraftsSuccess');
@@ -580,23 +579,16 @@ class MailboxDashBoardController extends ReloadableController {
void _saveEmailAsDraftsSuccess(SaveEmailAsDraftsSuccess success) {
if (currentContext != null && currentOverlayContext != null) {
- _appToast.showBottomToast(
- currentOverlayContext!,
- AppLocalizations.of(currentContext!).drafts_saved,
- actionName: AppLocalizations.of(currentContext!).discard,
- onActionClick: () => _discardEmail(success.emailAsDrafts),
- leadingIcon: SvgPicture.asset(
- _imagePaths.icMailboxDrafts,
- 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!).drafts_saved,
+ actionName: AppLocalizations.of(currentContext!).discard,
+ onActionClick: () => _discardEmail(success.emailAsDrafts),
+ leadingSVGIcon: _imagePaths.icMailboxDrafts,
+ leadingSVGIconColor: Colors.white,
+ backgroundColor: AppColor.toastSuccessBackgroundColor,
+ textColor: Colors.white,
+ actionIcon: SvgPicture.asset(_imagePaths.icUndo));
}
}
@@ -606,30 +598,24 @@ class MailboxDashBoardController extends ReloadableController {
void _moveToMailboxSuccess(MoveToMailboxSuccess success) {
if (success.moveAction == MoveAction.moving && currentContext != null && currentOverlayContext != null) {
- _appToast.showBottomToast(
- currentOverlayContext!,
- success.emailActionType.getToastMessageMoveToMailboxSuccess(currentContext!, destinationPath: success.destinationPath),
- actionName: AppLocalizations.of(currentContext!).undo,
- onActionClick: () {
- _revertedToOriginalMailbox(MoveToMailboxRequest(
- {success.destinationMailboxId: [success.emailId]},
- success.currentMailboxId,
- MoveAction.undo,
- sessionCurrent!,
- success.emailActionType));
- },
- 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!,
+ success.emailActionType.getToastMessageMoveToMailboxSuccess(currentContext!, destinationPath: success.destinationPath),
+ actionName: AppLocalizations.of(currentContext!).undo,
+ onActionClick: () {
+ _revertedToOriginalMailbox(MoveToMailboxRequest(
+ {success.destinationMailboxId: [success.emailId]},
+ success.currentMailboxId,
+ MoveAction.undo,
+ sessionCurrent!,
+ success.emailActionType
+ ));
+ },
+ leadingSVGIcon: _imagePaths.icFolderMailbox,
+ leadingSVGIconColor: Colors.white,
+ backgroundColor: AppColor.toastSuccessBackgroundColor,
+ textColor: Colors.white,
+ actionIcon: SvgPicture.asset(_imagePaths.icUndo));
}
}
@@ -655,12 +641,12 @@ class MailboxDashBoardController extends ReloadableController {
}
void _deleteEmailPermanentlySuccess(DeleteEmailPermanentlySuccess success) {
- if (currentContext != null && currentOverlayContext != null) {
- _appToast.showToastWithIcon(
- currentOverlayContext!,
- widthToast: _responsiveUtils.isDesktop(currentContext!) ? 360 : null,
- message: AppLocalizations.of(currentContext!).toast_message_delete_a_email_permanently_success,
- icon: _imagePaths.icDeleteToast);
+ if (currentOverlayContext != null && currentContext != null) {
+ _appToast.showToastSuccessMessage(
+ currentOverlayContext!,
+ AppLocalizations.of(currentContext!).toast_message_delete_a_email_permanently_success,
+ leadingSVGIcon: _imagePaths.icDeleteToast
+ );
}
}
@@ -704,16 +690,18 @@ class MailboxDashBoardController extends ReloadableController {
readActions = success.readActions;
}
- if (currentContext != null && readActions != null && currentOverlayContext != null) {
+ if (readActions != null && currentContext != null && currentOverlayContext != null) {
final message = readActions == ReadActions.markAsUnread
- ? AppLocalizations.of(currentContext!).marked_message_toast(AppLocalizations.of(currentContext!).unread)
- : AppLocalizations.of(currentContext!).marked_message_toast(AppLocalizations.of(currentContext!).read);
- _appToast.showToastWithIcon(
- currentOverlayContext!,
- message: message,
- icon: readActions == ReadActions.markAsUnread
- ? _imagePaths.icUnreadToast
- : _imagePaths.icReadToast);
+ ? AppLocalizations.of(currentContext!).marked_message_toast(AppLocalizations.of(currentContext!).unread)
+ : AppLocalizations.of(currentContext!).marked_message_toast(AppLocalizations.of(currentContext!).read);
+
+ _appToast.showToastSuccessMessage(
+ currentOverlayContext!,
+ message,
+ leadingSVGIcon: readActions == ReadActions.markAsUnread
+ ? _imagePaths.icUnreadToast
+ : _imagePaths.icReadToast
+ );
}
}
@@ -741,16 +729,19 @@ class MailboxDashBoardController extends ReloadableController {
countMarkStarSuccess = success.countMarkStarSuccess;
}
- if (currentContext != null && markStarAction != null && currentOverlayContext != null) {
+ if (markStarAction != null) {
final message = markStarAction == MarkStarAction.unMarkStar
- ? AppLocalizations.of(currentContext!).marked_unstar_multiple_item(countMarkStarSuccess)
- : AppLocalizations.of(currentContext!).marked_star_multiple_item(countMarkStarSuccess);
- _appToast.showToastWithIcon(
+ ? AppLocalizations.of(currentContext!).marked_unstar_multiple_item(countMarkStarSuccess)
+ : AppLocalizations.of(currentContext!).marked_star_multiple_item(countMarkStarSuccess);
+
+ if (currentOverlayContext != null && currentContext != null) {
+ _appToast.showToastMessage(
currentOverlayContext!,
- message: message,
- icon: markStarAction == MarkStarAction.unMarkStar
- ? _imagePaths.icUnStar
- : _imagePaths.icStar);
+ message,
+ leadingSVGIcon: markStarAction == MarkStarAction.unMarkStar
+ ? _imagePaths.icUnStar
+ : _imagePaths.icStar);
+ }
}
}
@@ -932,36 +923,31 @@ class MailboxDashBoardController extends ReloadableController {
currentOverlayContext != null &&
emailActionType != null &&
moveAction == MoveAction.moving) {
- _appToast.showBottomToast(
- currentOverlayContext!,
- emailActionType.getToastMessageMoveToMailboxSuccess(
- currentContext!,
- destinationPath: destinationPath),
- actionName: AppLocalizations.of(currentContext!).undo,
- onActionClick: () {
- final newCurrentMailboxId = destinationMailboxId;
- final newDestinationMailboxId = currentMailboxId;
- if (newCurrentMailboxId != null && newDestinationMailboxId != null) {
- _revertedSelectionEmailToOriginalMailbox(MoveToMailboxRequest(
- {newCurrentMailboxId: movedEmailIds},
- newDestinationMailboxId,
- MoveAction.undo,
- sessionCurrent!,
- emailActionType!,
- destinationPath: destinationPath));
- }
- },
- 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!,
+ emailActionType.getToastMessageMoveToMailboxSuccess(
+ currentContext!,
+ destinationPath: destinationPath),
+ actionName: AppLocalizations.of(currentContext!).undo,
+ onActionClick: () {
+ final newCurrentMailboxId = destinationMailboxId;
+ final newDestinationMailboxId = currentMailboxId;
+ if (newCurrentMailboxId != null && newDestinationMailboxId != null) {
+ _revertedSelectionEmailToOriginalMailbox(MoveToMailboxRequest(
+ {newCurrentMailboxId: movedEmailIds},
+ newDestinationMailboxId,
+ MoveAction.undo,
+ sessionCurrent!,
+ emailActionType!,
+ destinationPath: destinationPath
+ ));
+ }
+ },
+ leadingSVGIconColor: Colors.white,
+ leadingSVGIcon: _imagePaths.icFolderMailbox,
+ backgroundColor: AppColor.toastSuccessBackgroundColor,
+ textColor: Colors.white,
+ actionIcon: SvgPicture.asset(_imagePaths.icUndo),
);
}
}
@@ -1095,12 +1081,10 @@ class MailboxDashBoardController extends ReloadableController {
}
void _emptyTrashFolderSuccess(EmptyTrashFolderSuccess success) {
- if (currentContext != null && currentOverlayContext != null) {
- _appToast.showToastWithIcon(
- currentOverlayContext!,
- widthToast: _responsiveUtils.isDesktop(currentContext!) ? 360 : null,
- message: AppLocalizations.of(currentContext!).toast_message_empty_trash_folder_success,
- icon: _imagePaths.icDeleteToast);
+ if (currentOverlayContext != null && currentContext != null) {
+ _appToast.showToastSuccessMessage(
+ currentOverlayContext!,
+ AppLocalizations.of(currentContext!).toast_message_empty_trash_folder_success);
}
}
@@ -1122,12 +1106,10 @@ class MailboxDashBoardController extends ReloadableController {
listEmailIdResult = success.emailIds;
}
- if (currentContext != null && currentOverlayContext != null && listEmailIdResult.isNotEmpty) {
- _appToast.showToastWithIcon(
- currentOverlayContext!,
- widthToast: _responsiveUtils.isDesktop(currentContext!) ? 360 : null,
- message: AppLocalizations.of(currentContext!).toast_message_delete_multiple_email_permanently_success(listEmailIdResult.length),
- icon: _imagePaths.icDeleteToast);
+ if (currentOverlayContext != null && currentContext != null && listEmailIdResult.isNotEmpty) {
+ _appToast.showToastSuccessMessage(
+ currentOverlayContext!,
+ AppLocalizations.of(currentContext!).toast_message_delete_multiple_email_permanently_success(listEmailIdResult.length));
}
}
@@ -1237,21 +1219,17 @@ class MailboxDashBoardController extends ReloadableController {
if (success is MarkAsMailboxReadAllSuccess) {
if (currentContext != null && currentOverlayContext != null) {
- _appToast.showToastWithIcon(
- currentOverlayContext!,
- widthToast: _responsiveUtils.isDesktop(currentContext!) ? 360 : null,
- message: AppLocalizations.of(currentContext!)
- .toastMessageMarkAsMailboxReadSuccess(success.mailboxName.name),
- icon: _imagePaths.icReadToast);
+ _appToast.showToastSuccessMessage(
+ currentOverlayContext!,
+ AppLocalizations.of(currentContext!).toastMessageMarkAsMailboxReadSuccess(success.mailboxName.name),
+ leadingSVGIcon: _imagePaths.icReadToast);
}
} else if (success is MarkAsMailboxReadHasSomeEmailFailure) {
if (currentContext != null && currentOverlayContext != null) {
- _appToast.showToastWithIcon(
- currentOverlayContext!,
- widthToast: _responsiveUtils.isDesktop(currentContext!) ? 360 : null,
- message: AppLocalizations.of(currentContext!)
- .toastMessageMarkAsMailboxReadHasSomeEmailFailure(success.mailboxName.name, success.countEmailsRead),
- icon: _imagePaths.icReadToast);
+ _appToast.showToastSuccessMessage(
+ currentOverlayContext!,
+ AppLocalizations.of(currentContext!).toastMessageMarkAsMailboxReadHasSomeEmailFailure(success.mailboxName.name, success.countEmailsRead),
+ leadingSVGIcon: _imagePaths.icReadToast);
}
}
}
@@ -1347,10 +1325,9 @@ class MailboxDashBoardController 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('MailboxDashBoardController::_handleUpdateVacationSuccess(): $vacationResponse');
@@ -1623,13 +1600,11 @@ class MailboxDashBoardController extends ReloadableController {
}
void _showToastSendMessageFailure(String message) {
- if (currentOverlayContext != null) {
- _appToast.showToastWithIcon(
+ if (currentOverlayContext != null && currentContext != null) {
+ _appToast.showToastErrorMessage(
currentOverlayContext!,
- textColor: AppColor.toastErrorBackgroundColor,
- message: message,
- icon: _imagePaths.icSendToast
- );
+ message,
+ leadingSVGIcon: _imagePaths.icSendSuccessToast);
}
}
diff --git a/lib/features/manage_account/presentation/email_rules/email_rules_controller.dart b/lib/features/manage_account/presentation/email_rules/email_rules_controller.dart
index 5129ad47f..ac827bcd9 100644
--- a/lib/features/manage_account/presentation/email_rules/email_rules_controller.dart
+++ b/lib/features/manage_account/presentation/email_rules/email_rules_controller.dart
@@ -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) {
diff --git a/lib/features/manage_account/presentation/forward/forward_controller.dart b/lib/features/manage_account/presentation/forward/forward_controller.dart
index b1c2e65ce..f49d430f8 100644
--- a/lib/features/manage_account/presentation/forward/forward_controller.dart
+++ b/lib/features/manage_account/presentation/forward/forward_controller.dart
@@ -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;
diff --git a/lib/features/manage_account/presentation/forward/forward_view.dart b/lib/features/manage_account/presentation/forward/forward_view.dart
index bc5f225b2..c8e3f842f 100644
--- a/lib/features/manage_account/presentation/forward/forward_view.dart
+++ b/lib/features/manage_account/presentation/forward/forward_view.dart
@@ -133,19 +133,9 @@ class ForwardView extends GetWidget 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);
},
);
}
diff --git a/lib/features/manage_account/presentation/mailbox_visibility/mailbox_visibility_controller.dart b/lib/features/manage_account/presentation/mailbox_visibility/mailbox_visibility_controller.dart
index 7746143ec..2f47694ed 100644
--- a/lib/features/manage_account/presentation/mailbox_visibility/mailbox_visibility_controller.dart
+++ b/lib/features/manage_account/presentation/mailbox_visibility/mailbox_visibility_controller.dart
@@ -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();
final _appToast = Get.find();
final _imagePaths = Get.find();
- final _responsiveUtils = Get.find();
final mailboxListScrollController = ScrollController();
MailboxVisibilityController(
@@ -209,29 +207,22 @@ class MailboxVisibilityController extends BaseMailboxController {
{List? 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),
);
}
}
diff --git a/lib/features/manage_account/presentation/manage_account_dashboard_controller.dart b/lib/features/manage_account/presentation/manage_account_dashboard_controller.dart
index 45d703d42..80939a8ef 100644
--- a/lib/features/manage_account/presentation/manage_account_dashboard_controller.dart
+++ b/lib/features/manage_account/presentation/manage_account_dashboard_controller.dart
@@ -41,7 +41,6 @@ import 'package:tmail_ui_user/main/routes/route_utils.dart';
class ManageAccountDashBoardController extends ReloadableController {
final _appToast = Get.find();
- final _imagePaths = Get.find();
final _responsiveUtils = Get.find();
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');
diff --git a/lib/features/manage_account/presentation/profiles/identities/identities_controller.dart b/lib/features/manage_account/presentation/profiles/identities/identities_controller.dart
index 07e149ea6..c244895a4 100644
--- a/lib/features/manage_account/presentation/profiles/identities/identities_controller.dart
+++ b/lib/features/manage_account/presentation/profiles/identities/identities_controller.dart
@@ -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();
diff --git a/lib/features/manage_account/presentation/vacation/vacation_controller.dart b/lib/features/manage_account/presentation/vacation/vacation_controller.dart
index 7b029916d..87957eb1a 100644
--- a/lib/features/manage_account/presentation/vacation/vacation_controller.dart
+++ b/lib/features/manage_account/presentation/vacation/vacation_controller.dart
@@ -29,7 +29,6 @@ class VacationController extends BaseController {
final _accountDashBoardController = Get.find();
final _appToast = Get.find();
- final _imagePaths = Get.find();
final _settingController = Get.find();
final _richTextControllerForWeb = Get.find(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');
diff --git a/lib/features/network_status_handle/presentation/network_connnection_controller.dart b/lib/features/network_status_handle/presentation/network_connnection_controller.dart
index ebcbc3473..668b9c8f1 100644
--- a/lib/features/network_status_handle/presentation/network_connnection_controller.dart
+++ b/lib/features/network_status_handle/presentation/network_connnection_controller.dart
@@ -3,7 +3,6 @@ import 'dart:async';
import 'package:connectivity_plus/connectivity_plus.dart';
import 'package:core/core.dart';
import 'package:flutter/material.dart';
-import 'package:flutter_svg/flutter_svg.dart';
import 'package:get/get.dart';
import 'package:tmail_ui_user/features/base/base_controller.dart';
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
@@ -14,7 +13,6 @@ class NetworkConnectionController extends BaseController {
final _imagePaths = Get.find();
final Connectivity _connectivity;
final AppToast _appToast = Get.find();
- final ResponsiveUtils _responsiveUtils = Get.find();
bool _isEnableShowToastDisconnection = true;
@@ -84,24 +82,18 @@ class NetworkConnectionController extends BaseController {
void _showToastLostConnection() {
if (currentContext != null && currentOverlayContext != null) {
- _appToast.showBottomToast(
- currentOverlayContext!,
- AppLocalizations.of(currentContext!).no_internet_connection,
- actionName: AppLocalizations.of(currentContext!).skip,
- onActionClick: () {
- _isEnableShowToastDisconnection = false;
- ToastView.dismiss();
- },
- leadingIcon: SvgPicture.asset(
- _imagePaths.icNotConnection,
- width: 24,
- height: 24,
- fit: BoxFit.fill),
- backgroundColor: AppColor.textFieldErrorBorderColor,
- textColor: Colors.white,
- textActionColor: Colors.white,
- maxWidth: _responsiveUtils.getMaxWidthToast(currentContext!),
- infinityToast: true,
+ _appToast.showToastMessage(
+ currentOverlayContext!,
+ AppLocalizations.of(currentContext!).no_internet_connection,
+ actionName: AppLocalizations.of(currentContext!).skip,
+ onActionClick: () {
+ _isEnableShowToastDisconnection = false;
+ ToastView.dismiss();
+ },
+ leadingSVGIcon: _imagePaths.icNotConnection,
+ backgroundColor: AppColor.textFieldErrorBorderColor,
+ textColor: Colors.white,
+ infinityToast: true,
);
}
}
diff --git a/lib/features/rules_filter_creator/presentation/rules_filter_creator_controller.dart b/lib/features/rules_filter_creator/presentation/rules_filter_creator_controller.dart
index b9331d172..931eb5d11 100644
--- a/lib/features/rules_filter_creator/presentation/rules_filter_creator_controller.dart
+++ b/lib/features/rules_filter_creator/presentation/rules_filter_creator_controller.dart
@@ -1,5 +1,4 @@
-import 'package:core/presentation/extensions/color_extension.dart';
import 'package:core/presentation/state/failure.dart';
import 'package:core/presentation/state/success.dart';
import 'package:core/presentation/utils/app_toast.dart';
@@ -281,20 +280,22 @@ class RulesFilterCreatorController extends BaseMailboxController {
final errorAction = _getErrorStringByInputValue(context, mailboxSelected.value?.name?.name);
if (errorAction?.isNotEmpty == true) {
errorRuleActionValue.value = errorAction;
- _appToast.showToastWithIcon(
+ if (currentOverlayContext != null && currentContext != null) {
+ _appToast.showToastErrorMessage(
currentOverlayContext!,
- textColor: AppColor.toastErrorBackgroundColor,
- message: AppLocalizations.of(currentContext!).this_field_cannot_be_blank);
+ AppLocalizations.of(currentContext!).this_field_cannot_be_blank);
+ }
return;
}
if (ruleConditionFieldSelected.value == null ||
ruleConditionComparatorSelected.value == null ||
emailRuleFilterActionSelected.value == null) {
- _appToast.showToastWithIcon(
+ if (currentOverlayContext != null && currentContext != null) {
+ _appToast.showToastErrorMessage(
currentOverlayContext!,
- textColor: AppColor.toastErrorBackgroundColor,
- message: AppLocalizations.of(currentContext!).toastErrorMessageWhenCreateNewRule);
+ AppLocalizations.of(currentContext!).toastErrorMessageWhenCreateNewRule);
+ }
return;
}
diff --git a/lib/features/search/mailbox/presentation/search_mailbox_controller.dart b/lib/features/search/mailbox/presentation/search_mailbox_controller.dart
index 7b89b6295..d6c71562e 100644
--- a/lib/features/search/mailbox/presentation/search_mailbox_controller.dart
+++ b/lib/features/search/mailbox/presentation/search_mailbox_controller.dart
@@ -332,7 +332,7 @@ class SearchMailboxController extends BaseMailboxController with MailboxActionHa
void _moveMailboxSuccess(MoveMailboxSuccess success) {
if (success.moveAction == MoveAction.moving && currentOverlayContext != null && currentContext != null) {
- _appToast.showBottomToast(
+ _appToast.showToastMessage(
currentOverlayContext!,
AppLocalizations.of(currentContext!).moved_to_mailbox(success.destinationMailboxName?.name ?? AppLocalizations.of(currentContext!).allMailboxes),
actionName: AppLocalizations.of(currentContext!).undo,
@@ -344,17 +344,11 @@ class SearchMailboxController extends BaseMailboxController with MailboxActionHa
parentId: success.destinationMailboxId)
);
},
- leadingIcon: SvgPicture.asset(
- imagePaths.icFolderMailbox,
- width: 24,
- height: 24,
- colorFilter: Colors.white.asFilter(),
- fit: BoxFit.fill),
+ leadingSVGIconColor: Colors.white,
+ leadingSVGIcon: imagePaths.icFolderMailbox,
backgroundColor: AppColor.toastSuccessBackgroundColor,
textColor: Colors.white,
- textActionColor: Colors.white,
- actionIcon: SvgPicture.asset(imagePaths.icUndo),
- maxWidth: responsiveUtils.getMaxWidthToast(currentContext!)
+ actionIcon: SvgPicture.asset(imagePaths.icUndo)
);
}
@@ -396,11 +390,9 @@ class SearchMailboxController extends BaseMailboxController with MailboxActionHa
void _deleteMultipleMailboxSuccess(List listMailboxIdDeleted, jmap.State? currentMailboxState) {
if (currentOverlayContext != null && currentContext != null) {
- _appToast.showToastWithIcon(
+ _appToast.showToastSuccessMessage(
currentOverlayContext!,
- message: AppLocalizations.of(currentContext!).delete_mailboxes_successfully,
- icon: imagePaths.icSelected
- );
+ AppLocalizations.of(currentContext!).delete_mailboxes_successfully);
}
if (listMailboxIdDeleted.contains(dashboardController.selectedMailbox.value?.id)) {
@@ -413,11 +405,9 @@ class SearchMailboxController extends BaseMailboxController with MailboxActionHa
void _deleteMailboxFailure(DeleteMultipleMailboxFailure failure) {
if (currentOverlayContext != null && currentContext != null) {
- _appToast.showToastWithIcon(
+ _appToast.showToastErrorMessage(
currentOverlayContext!,
- message: AppLocalizations.of(currentContext!).delete_mailboxes_failure,
- icon: imagePaths.icDeleteToast
- );
+ AppLocalizations.of(currentContext!).delete_mailboxes_failure);
}
}
@@ -503,7 +493,7 @@ class SearchMailboxController extends BaseMailboxController with MailboxActionHa
{List? listDescendantMailboxIds}
) {
if (currentOverlayContext != null && currentContext != null) {
- _appToast.showBottomToast(
+ _appToast.showToastMessage(
currentOverlayContext!,
subscribeAction.getToastMessageSuccess(currentContext!),
actionName: AppLocalizations.of(currentContext!).undo,
@@ -520,18 +510,11 @@ class SearchMailboxController extends BaseMailboxController with MailboxActionHa
);
}
},
- leadingIcon: SvgPicture.asset(
- imagePaths.icFolderMailbox,
- width: 24,
- height: 24,
- colorFilter: Colors.white.asFilter(),
- fit: BoxFit.fill
- ),
+ leadingSVGIconColor: Colors.white,
+ leadingSVGIcon: imagePaths.icFolderMailbox,
backgroundColor: AppColor.toastSuccessBackgroundColor,
textColor: Colors.white,
- textActionColor: Colors.white,
actionIcon: SvgPicture.asset(imagePaths.icUndo),
- maxWidth: responsiveUtils.getMaxWidthToast(currentContext!)
);
}
}
diff --git a/lib/features/session/presentation/session_controller.dart b/lib/features/session/presentation/session_controller.dart
index 86bb257ec..e9567f078 100644
--- a/lib/features/session/presentation/session_controller.dart
+++ b/lib/features/session/presentation/session_controller.dart
@@ -71,17 +71,23 @@ class SessionController extends ReloadableController {
log('SessionController::_handleSessionFailure(): $failure');
if (failure is GetSessionFailure) {
final sessionException = failure.exception;
+ var errorMessage = '';
if (_checkUrlError(sessionException) && currentContext != null) {
- _appToast.showErrorToast(AppLocalizations.of(currentContext!).wrongUrlMessage);
+ errorMessage = AppLocalizations.of(currentContext!).wrongUrlMessage;
} else if (sessionException is BadCredentialsException && currentContext != null) {
- _appToast.showErrorToast(AppLocalizations.of(currentContext!).badCredentials);
+ errorMessage = AppLocalizations.of(currentContext!).badCredentials;
} else if (sessionException is UnknownError && currentContext != null) {
if (sessionException.message != null) {
- _appToast.showErrorToast('[${sessionException.code}] ${sessionException.message}');
+ errorMessage = '[${sessionException.code}] ${sessionException.message}';
} else {
- _appToast.showErrorToast(AppLocalizations.of(currentContext!).unknownError);
+ errorMessage = AppLocalizations.of(currentContext!).unknownError;
}
}
+
+ logError('SessionController::_handleSessionFailure():errorMessage: $errorMessage');
+ if (errorMessage.isNotEmpty && currentOverlayContext != null && currentContext != null) {
+ _appToast.showToastErrorMessage(currentOverlayContext!, errorMessage);
+ }
}
}
diff --git a/lib/features/thread/presentation/thread_controller.dart b/lib/features/thread/presentation/thread_controller.dart
index 9344f276c..de4f923e5 100644
--- a/lib/features/thread/presentation/thread_controller.dart
+++ b/lib/features/thread/presentation/thread_controller.dart
@@ -642,10 +642,11 @@ class ThreadController extends BaseController with EmailActionController {
mailboxDashBoardController.filterMessageOption.value = newFilterOption;
- _appToast.showToastWithIcon(
- currentOverlayContext!,
- message: newFilterOption.getMessageToast(context),
- icon: newFilterOption.getIconToast(_imagePaths));
+ _appToast.showToastMessage(
+ context,
+ newFilterOption.getMessageToast(context),
+ leadingSVGIcon: newFilterOption.getIconToast(_imagePaths),
+ );
if (searchController.isSearchEmailRunning) {
_searchEmail();
diff --git a/lib/features/thread/presentation/thread_view.dart b/lib/features/thread/presentation/thread_view.dart
index f1db91b0f..549e5a09f 100644
--- a/lib/features/thread/presentation/thread_view.dart
+++ b/lib/features/thread/presentation/thread_view.dart
@@ -126,20 +126,18 @@ class ThreadView extends GetWidget
if ((!BuildUtils.isWeb || (BuildUtils.isWeb && controller.isSelectionEnabled()
&& controller.isSearchActive() && !_responsiveUtils.isDesktop(context)))
&& controller.mailboxDashBoardController.emailsInCurrentMailbox.listEmailSelected.isNotEmpty) {
- return Column(children: [
- const Divider(color: AppColor.lineItemListColor, height: 1, thickness: 0.2),
- Padding(
- padding: const EdgeInsets.all(10),
- child: (BottomBarThreadSelectionWidget(
- context,
- _imagePaths,
- _responsiveUtils,
- controller.mailboxDashBoardController.emailsInCurrentMailbox.listEmailSelected,
- controller.mailboxDashBoardController.selectedMailbox.value)
- ..addOnPressEmailSelectionActionClick((actionType, selectionEmail) =>
- controller.pressEmailSelectionAction(context, actionType, selectionEmail)))
- .build()),
- ]);
+ return BottomBarThreadSelectionWidget(
+ _imagePaths,
+ _responsiveUtils,
+ controller.mailboxDashBoardController.emailsInCurrentMailbox.listEmailSelected,
+ controller.mailboxDashBoardController.selectedMailbox.value,
+ onPressEmailSelectionActionClick: (actionType, selectionEmail) =>
+ controller.pressEmailSelectionAction(
+ context,
+ actionType,
+ selectionEmail
+ )
+ );
} else {
return const SizedBox.shrink();
}
diff --git a/lib/features/thread/presentation/widgets/bottom_bar_thread_selection_widget.dart b/lib/features/thread/presentation/widgets/bottom_bar_thread_selection_widget.dart
index 55388ba46..7267e3ef0 100644
--- a/lib/features/thread/presentation/widgets/bottom_bar_thread_selection_widget.dart
+++ b/lib/features/thread/presentation/widgets/bottom_bar_thread_selection_widget.dart
@@ -1,114 +1,120 @@
-import 'package:core/core.dart';
+import 'package:core/presentation/extensions/color_extension.dart';
+import 'package:core/presentation/resources/image_paths.dart';
+import 'package:core/presentation/utils/responsive_utils.dart';
+import 'package:core/presentation/views/button/button_builder.dart';
+import 'package:core/utils/build_utils.dart';
import 'package:flutter/material.dart';
-import 'package:model/model.dart';
+import 'package:model/email/email_action_type.dart';
+import 'package:model/email/presentation_email.dart';
+import 'package:model/extensions/list_presentation_email_extension.dart';
+import 'package:model/mailbox/presentation_mailbox.dart';
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
typedef OnPressEmailSelectionActionClick = void Function(EmailActionType, List);
-class BottomBarThreadSelectionWidget {
+class BottomBarThreadSelectionWidget extends StatelessWidget{
- final BuildContext _context;
final ImagePaths _imagePaths;
final ResponsiveUtils _responsiveUtils;
final List _listSelectionEmail;
final PresentationMailbox? _currentMailbox;
+ final OnPressEmailSelectionActionClick? onPressEmailSelectionActionClick;
- OnPressEmailSelectionActionClick? _onPressEmailSelectionActionClick;
-
- BottomBarThreadSelectionWidget(
- this._context,
+ const BottomBarThreadSelectionWidget(
this._imagePaths,
this._responsiveUtils,
this._listSelectionEmail,
this._currentMailbox,
+ {
+ super.key,
+ this.onPressEmailSelectionActionClick,
+ }
);
- void addOnPressEmailSelectionActionClick(OnPressEmailSelectionActionClick onPressEmailSelectionActionClick) {
- _onPressEmailSelectionActionClick = onPressEmailSelectionActionClick;
- }
-
- Widget build() {
+ @override
+ Widget build(BuildContext context) {
return Container(
key: const Key('bottom_bar_thread_selection_widget'),
- alignment: Alignment.center,
- color: Colors.white,
- child: MediaQuery(
- data: const MediaQueryData(padding: EdgeInsets.zero),
- child: _buildListOptionButton()
- )
- );
- }
-
- Widget _buildListOptionButton() {
- return Row(
- mainAxisAlignment: MainAxisAlignment.center,
- crossAxisAlignment: CrossAxisAlignment.center,
- children: [
- if(_currentMailbox?.isDrafts == false)
- Expanded(child: (ButtonBuilder(_listSelectionEmail.isAllEmailRead ? _imagePaths.icUnread : _imagePaths.icRead)
+ decoration: const BoxDecoration(
+ border: Border(top: BorderSide(
+ color: AppColor.lineItemListColor,
+ width: 0.2,
+ )),
+ color: Colors.white
+ ),
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.center,
+ children: [
+ if(_currentMailbox?.isDrafts == false)
+ Expanded(child: (ButtonBuilder(_listSelectionEmail.isAllEmailRead ? _imagePaths.icUnread : _imagePaths.icRead)
..key(const Key('button_mark_read_email'))
- ..paddingIcon(const EdgeInsets.symmetric(horizontal: 8, vertical: 4))
+ ..padding(const EdgeInsets.all(8))
+ ..radiusSplash(8)
..textStyle(const TextStyle(fontSize: 12, color: AppColor.colorTextButton))
..onPressActionClick(() {
- if (_onPressEmailSelectionActionClick != null) {
- _onPressEmailSelectionActionClick!(
- _listSelectionEmail.isAllEmailRead ? EmailActionType.markAsUnread : EmailActionType.markAsRead,
- _listSelectionEmail);
- }})
- ..text(_textButtonMarkAsRead, isVertical: _responsiveUtils.isMobile(_context)))
+ onPressEmailSelectionActionClick?.call(
+ _listSelectionEmail.isAllEmailRead ? EmailActionType.markAsUnread : EmailActionType.markAsRead,
+ _listSelectionEmail
+ );
+ })
+ ..text(_getTextButtonMarkAsRead(context), isVertical: _responsiveUtils.isMobile(context)))
.build()),
- Expanded(child: (ButtonBuilder(_listSelectionEmail.isAllEmailStarred ? _imagePaths.icUnStar : _imagePaths.icStar)
+ Expanded(child: (ButtonBuilder(_listSelectionEmail.isAllEmailStarred ? _imagePaths.icUnStar : _imagePaths.icStar)
..key(const Key('button_mark_as_star_email'))
- ..paddingIcon(const EdgeInsets.symmetric(horizontal: 8, vertical: 4))
+ ..padding(const EdgeInsets.all(8))
+ ..radiusSplash(8)
..textStyle(const TextStyle(fontSize: 12, color: AppColor.colorTextButton))
..onPressActionClick(() {
- if (_onPressEmailSelectionActionClick != null) {
- _onPressEmailSelectionActionClick!(
- _listSelectionEmail.isAllEmailStarred ? EmailActionType.unMarkAsStarred : EmailActionType.markAsStarred,
- _listSelectionEmail);
- }})
- ..text(_textButtonMarkAsStar, isVertical: _responsiveUtils.isMobile(_context)))
+ onPressEmailSelectionActionClick?.call(
+ _listSelectionEmail.isAllEmailStarred ? EmailActionType.unMarkAsStarred : EmailActionType.markAsStarred,
+ _listSelectionEmail
+ );
+ })
+ ..text(_getTextButtonMarkAsStar(context), isVertical: _responsiveUtils.isMobile(context)))
.build()),
- if (_currentMailbox?.isDrafts == false)
- Expanded(child: (ButtonBuilder(_imagePaths.icMove)
+ if (_currentMailbox?.isDrafts == false)
+ Expanded(child: (ButtonBuilder(_imagePaths.icMove)
..key(const Key('button_move_to_mailbox'))
- ..paddingIcon(const EdgeInsets.symmetric(horizontal: 8, vertical: 4))
+ ..padding(const EdgeInsets.all(8))
+ ..radiusSplash(8)
..textStyle(const TextStyle(fontSize: 12, color: AppColor.colorTextButton))
..onPressActionClick(() {
- if (_onPressEmailSelectionActionClick != null) {
- _onPressEmailSelectionActionClick!(EmailActionType.moveToMailbox, _listSelectionEmail);
- }})
- ..text(_textButtonMove, isVertical: _responsiveUtils.isMobile(_context)))
+ onPressEmailSelectionActionClick?.call(EmailActionType.moveToMailbox, _listSelectionEmail);
+ })
+ ..text(_getTextButtonMove(context), isVertical: _responsiveUtils.isMobile(context)))
.build()),
- if (_currentMailbox?.isDrafts == false)
- Expanded(child: (ButtonBuilder(_currentMailbox?.isSpam == true ? _imagePaths.icNotSpam : _imagePaths.icSpam)
+ if (_currentMailbox?.isDrafts == false)
+ Expanded(child: (ButtonBuilder(_currentMailbox?.isSpam == true ? _imagePaths.icNotSpam : _imagePaths.icSpam)
..key(const Key('button_move_to_spam'))
- ..paddingIcon(const EdgeInsets.symmetric(horizontal: 8, vertical: 4))
+ ..padding(const EdgeInsets.all(8))
+ ..radiusSplash(8)
..textStyle(const TextStyle(fontSize: 12, color: AppColor.colorTextButton))
..onPressActionClick(() {
if (_currentMailbox?.isSpam == true) {
- _onPressEmailSelectionActionClick?.call(EmailActionType.unSpam, _listSelectionEmail);
+ onPressEmailSelectionActionClick?.call(EmailActionType.unSpam, _listSelectionEmail);
} else {
- _onPressEmailSelectionActionClick?.call(EmailActionType.moveToSpam, _listSelectionEmail);
+ onPressEmailSelectionActionClick?.call(EmailActionType.moveToSpam, _listSelectionEmail);
}
})
- ..text(_textButtonSpam, isVertical: _responsiveUtils.isMobile(_context)))
+ ..text(_getTextButtonSpam(context), isVertical: _responsiveUtils.isMobile(context)))
.build()),
- Expanded(child: (ButtonBuilder(canDeletePermanently ? _imagePaths.icDeleteComposer : _imagePaths.icDelete)
+ Expanded(child: (ButtonBuilder(canDeletePermanently ? _imagePaths.icDeleteComposer : _imagePaths.icDelete)
..key(const Key('button_delete_email'))
..iconColor(canDeletePermanently ? AppColor.colorDeletePermanentlyButton : AppColor.primaryColor)
- ..paddingIcon(const EdgeInsets.symmetric(horizontal: 8, vertical: 4))
+ ..padding(const EdgeInsets.all(8))
+ ..radiusSplash(8)
..textStyle(const TextStyle(fontSize: 12, color: AppColor.colorTextButton))
..onPressActionClick(() {
if (canDeletePermanently) {
- _onPressEmailSelectionActionClick?.call(EmailActionType.deletePermanently, _listSelectionEmail);
+ onPressEmailSelectionActionClick?.call(EmailActionType.deletePermanently, _listSelectionEmail);
} else {
- _onPressEmailSelectionActionClick?.call(EmailActionType.moveToTrash, _listSelectionEmail);
+ onPressEmailSelectionActionClick?.call(EmailActionType.moveToTrash, _listSelectionEmail);
}
})
- ..text(_textButtonDelete, isVertical: _responsiveUtils.isMobile(_context)))
+ ..text(_getTextButtonDelete(context), isVertical: _responsiveUtils.isMobile(context)))
.build())
- ]
+ ]
+ )
);
}
@@ -116,43 +122,43 @@ class BottomBarThreadSelectionWidget {
return _currentMailbox?.isTrash == true || _currentMailbox?.isDrafts == true;
}
- String? get _textButtonMarkAsRead {
- if (!_isMailboxDashboardSplitView(_context)) {
+ String? _getTextButtonMarkAsRead(BuildContext context) {
+ if (!_isMailboxDashboardSplitView(context)) {
return _listSelectionEmail.isAllEmailRead
- ? AppLocalizations.of(_context).unread
- : AppLocalizations.of(_context).read;
+ ? AppLocalizations.of(context).unread
+ : AppLocalizations.of(context).read;
}
return null;
}
- String? get _textButtonMarkAsStar {
- if (!_isMailboxDashboardSplitView(_context)) {
+ String? _getTextButtonMarkAsStar(BuildContext context) {
+ if (!_isMailboxDashboardSplitView(context)) {
return _listSelectionEmail.isAllEmailStarred
- ? AppLocalizations.of(_context).un_star
- : AppLocalizations.of(_context).star;
+ ? AppLocalizations.of(context).un_star
+ : AppLocalizations.of(context).star;
}
return null;
}
- String? get _textButtonMove {
- if (!_isMailboxDashboardSplitView(_context)) {
- return AppLocalizations.of(_context).move;
+ String? _getTextButtonMove(BuildContext context) {
+ if (!_isMailboxDashboardSplitView(context)) {
+ return AppLocalizations.of(context).move;
}
return null;
}
- String? get _textButtonSpam {
- if (!_isMailboxDashboardSplitView(_context)) {
+ String? _getTextButtonSpam(BuildContext context) {
+ if (!_isMailboxDashboardSplitView(context)) {
return _currentMailbox?.isSpam == true
- ? AppLocalizations.of(_context).un_spam
- : AppLocalizations.of(_context).spam;
+ ? AppLocalizations.of(context).un_spam
+ : AppLocalizations.of(context).spam;
}
return null;
}
- String? get _textButtonDelete {
- if (!_isMailboxDashboardSplitView(_context)) {
- return AppLocalizations.of(_context).delete;
+ String? _getTextButtonDelete(BuildContext context) {
+ if (!_isMailboxDashboardSplitView(context)) {
+ return AppLocalizations.of(context).delete;
}
return null;
}
@@ -162,8 +168,8 @@ class BottomBarThreadSelectionWidget {
return _responsiveUtils.isTabletLarge(context);
} else {
return _responsiveUtils.isLandscapeTablet(context) ||
- _responsiveUtils.isTabletLarge(context) ||
- _responsiveUtils.isDesktop(context);
+ _responsiveUtils.isTabletLarge(context) ||
+ _responsiveUtils.isDesktop(context);
}
}
}
\ No newline at end of file
diff --git a/lib/features/upload/presentation/controller/upload_controller.dart b/lib/features/upload/presentation/controller/upload_controller.dart
index 5940507c9..ba851bc4d 100644
--- a/lib/features/upload/presentation/controller/upload_controller.dart
+++ b/lib/features/upload/presentation/controller/upload_controller.dart
@@ -1,7 +1,6 @@
import 'package:async/async.dart';
import 'package:collection/collection.dart';
-import 'package:core/presentation/extensions/color_extension.dart';
import 'package:core/presentation/resources/image_paths.dart';
import 'package:core/presentation/state/failure.dart';
import 'package:core/presentation/state/success.dart';
@@ -9,6 +8,7 @@ import 'package:core/presentation/utils/app_toast.dart';
import 'package:core/utils/app_logger.dart';
import 'package:dartz/dartz.dart';
import 'package:dio/dio.dart';
+import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:jmap_dart_client/jmap/mail/email/email_body_part.dart';
import 'package:model/email/attachment.dart';
@@ -128,13 +128,13 @@ class UploadController extends BaseController {
if (failure is ErrorAttachmentUploadState) {
uploadInlineViewState.value = Left(failure);
_deleteInlineFileUploaded(failure.uploadId);
+
if (currentContext != null && currentOverlayContext != null) {
- _appToast.showToastWithIcon(currentOverlayContext!,
- message: AppLocalizations.of(currentContext!).thisImageCannotBeAdded,
- textColor: AppColor.toastErrorBackgroundColor,
- iconColor: AppColor.toastErrorBackgroundColor,
- icon: _imagePaths.icInsertImage
- );
+ _appToast.showToastErrorMessage(
+ currentOverlayContext!,
+ AppLocalizations.of(currentContext!).thisImageCannotBeAdded,
+ leadingSVGIconColor: Colors.white,
+ leadingSVGIcon: _imagePaths.icInsertImage);
}
}
},
@@ -241,21 +241,22 @@ class UploadController extends BaseController {
void _handleUploadAttachmentsFailure(ErrorAttachmentUploadState failure) {
if (currentContext != null && currentOverlayContext != null) {
- _appToast.showToastWithIcon(currentOverlayContext!,
- message: AppLocalizations.of(currentContext!).can_not_upload_this_file_as_attachments,
- textColor: AppColor.toastErrorBackgroundColor,
- iconColor: AppColor.toastErrorBackgroundColor,
- icon: _imagePaths.icAttachment);
+ _appToast.showToastErrorMessage(
+ currentOverlayContext!,
+ AppLocalizations.of(currentContext!).can_not_upload_this_file_as_attachments,
+ leadingSVGIconColor: Colors.white,
+ leadingSVGIcon: _imagePaths.icAttachment);
}
}
void _handleUploadAttachmentsSuccess(SuccessAttachmentUploadState success) {
log('UploadController::_handleUploadAttachmentsSuccess(): $success');
if (currentContext != null && currentOverlayContext != null && _uploadingStateFiles.allSuccess) {
- _appToast.showToastWithIcon(currentOverlayContext!,
- message: AppLocalizations.of(currentContext!).attachments_uploaded_successfully,
- iconColor: AppColor.primaryColor,
- icon: _imagePaths.icAttachment);
+ _appToast.showToastSuccessMessage(
+ currentOverlayContext!,
+ AppLocalizations.of(currentContext!).attachments_uploaded_successfully,
+ leadingSVGIconColor: Colors.white,
+ leadingSVGIcon: _imagePaths.icAttachment);
}
}
@@ -348,21 +349,19 @@ class UploadController extends BaseController {
if (failure is UploadAttachmentFailure) {
if (failure.isInline) {
if (currentContext != null && currentOverlayContext != null) {
- _appToast.showToastWithIcon(currentOverlayContext!,
- message: AppLocalizations.of(currentContext!).thisImageCannotBeAdded,
- textColor: AppColor.toastErrorBackgroundColor,
- iconColor: AppColor.toastErrorBackgroundColor,
- icon: _imagePaths.icInsertImage
- );
+ _appToast.showToastErrorMessage(
+ currentOverlayContext!,
+ AppLocalizations.of(currentContext!).thisImageCannotBeAdded,
+ leadingSVGIconColor: Colors.white,
+ leadingSVGIcon: _imagePaths.icInsertImage);
}
} else {
if (currentContext != null && currentOverlayContext != null) {
- _appToast.showToastWithIcon(currentOverlayContext!,
- message: AppLocalizations.of(currentContext!).can_not_upload_this_file_as_attachments,
- textColor: AppColor.toastErrorBackgroundColor,
- iconColor: AppColor.toastErrorBackgroundColor,
- icon: _imagePaths.icAttachment
- );
+ _appToast.showToastErrorMessage(
+ currentOverlayContext!,
+ AppLocalizations.of(currentContext!).can_not_upload_this_file_as_attachments,
+ leadingSVGIconColor: Colors.white,
+ leadingSVGIcon: _imagePaths.icAttachment);
}
}
}