diff --git a/assets/images/empty_image_default.svg b/assets/images/empty_image_default.svg
deleted file mode 100644
index fd0b26259..000000000
--- a/assets/images/empty_image_default.svg
+++ /dev/null
@@ -1,9 +0,0 @@
-
diff --git a/assets/images/ic_empty_email.svg b/assets/images/ic_empty_email.svg
new file mode 100644
index 000000000..ccde949b2
--- /dev/null
+++ b/assets/images/ic_empty_email.svg
@@ -0,0 +1,87 @@
+
diff --git a/core/lib/presentation/extensions/color_extension.dart b/core/lib/presentation/extensions/color_extension.dart
index 55e4a849b..55a77ab83 100644
--- a/core/lib/presentation/extensions/color_extension.dart
+++ b/core/lib/presentation/extensions/color_extension.dart
@@ -171,6 +171,7 @@ extension AppColor on Color {
static const colorThumbScrollBar = Color(0xFFAEB7C2);
static const colorCreateNewIdentityButton = Color(0xFFEBEDF0);
static const colorSpamReportBox = Color(0xFFBFDEFF);
+ static const colorSubtitle = Color(0xFF6D7885);
static const mapGradientColor = [
[Color(0xFF21D4FD), Color(0xFFB721FF)],
diff --git a/core/lib/presentation/resources/image_paths.dart b/core/lib/presentation/resources/image_paths.dart
index b07ec2046..de1b8de76 100644
--- a/core/lib/presentation/resources/image_paths.dart
+++ b/core/lib/presentation/resources/image_paths.dart
@@ -12,7 +12,7 @@ class ImagePaths {
String get icDownload => _getImagePath('ic_download.svg');
String get icMore => _getImagePath('ic_more.svg');
String get icPhotoLibrary => _getImagePath('ic_photo_library.svg');
- String get icEmptyImageDefault => _getImagePath('empty_image_default.svg');
+ String get icEmptyEmail => _getImagePath('ic_empty_email.svg');
String get icStar => _getImagePath('ic_star.svg');
String get icUnStar => _getImagePath('ic_unstar.svg');
String get icAttachment => _getImagePath('ic_attachment.svg');
diff --git a/core/lib/presentation/views/background/background_widget_builder.dart b/core/lib/presentation/views/background/background_widget_builder.dart
index 865d47558..a110ff935 100644
--- a/core/lib/presentation/views/background/background_widget_builder.dart
+++ b/core/lib/presentation/views/background/background_widget_builder.dart
@@ -1,55 +1,85 @@
-import 'package:core/core.dart';
-import 'package:flutter/widgets.dart';
+import 'package:core/presentation/extensions/color_extension.dart';
+import 'package:core/presentation/utils/responsive_utils.dart';
+import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
-class BackgroundWidgetBuilder {
- Key? _key;
- SvgPicture? _image;
- String? _text;
+class BackgroundWidgetBuilder extends StatelessWidget {
- final BuildContext _context;
+ final ResponsiveUtils responsiveUtils;
+ final String title;
+ final String? iconSVG;
+ final String? subTitle;
+ final double? maxWidth;
- BackgroundWidgetBuilder(this._context);
+ const BackgroundWidgetBuilder(
+ this.title,
+ this.responsiveUtils, {
+ Key? key,
+ this.iconSVG,
+ this.subTitle,
+ this.maxWidth
+ }) : super(key: key);
- void key(Key key) {
- _key = key;
- }
-
- void image(SvgPicture image) {
- _image = image;
- }
-
- void text(String text) {
- _text = text;
- }
-
- Widget build() {
+ @override
+ Widget build(BuildContext context) {
return Center(
- key: _key ?? const Key('BackgroundWidgetBuilder'),
- child: CustomScrollView(
- slivers: [
- SliverFillRemaining(
- child: SizedBox(
- child: Column(
- mainAxisAlignment: MainAxisAlignment.center,
- crossAxisAlignment: CrossAxisAlignment.center,
- children: [
- _image ?? const SizedBox.shrink(),
- Padding(
- padding: EdgeInsets.only(top: _image != null ? 16 : 0),
- child: Text(
- _text ?? '',
- style: const TextStyle(color: AppColor.baseTextColor, fontSize: 16),
- textAlign: TextAlign.center,
+ key: const Key('background_widget'),
+ child: SizedBox(
+ width: maxWidth ?? 360,
+ child: CustomScrollView(
+ slivers: [
+ SliverFillRemaining(
+ child: Container(
+ color: Colors.transparent,
+ padding: const EdgeInsets.symmetric(horizontal: 12),
+ child: Column(
+ mainAxisAlignment: MainAxisAlignment.center,
+ crossAxisAlignment: CrossAxisAlignment.center,
+ children: [
+ if (iconSVG != null)
+ SvgPicture.asset(
+ iconSVG!,
+ width: responsiveUtils.isLandscapeMobile(context)
+ ? 120
+ : 212,
+ height: responsiveUtils.isLandscapeMobile(context)
+ ? 120
+ : 212,
+ fit: BoxFit.fill
+ ),
+ Padding(
+ padding: EdgeInsets.only(top: iconSVG != null ? 12 : 0),
+ child: Text(
+ title,
+ style: const TextStyle(
+ color: Colors.black,
+ fontSize: 20,
+ fontWeight: FontWeight.normal
+ ),
+ textAlign: TextAlign.center,
+ ),
),
- ),
- ],
+ if (subTitle != null)
+ Padding(
+ padding: const EdgeInsets.only(top: 12),
+ child: Text(
+ subTitle!,
+ style: const TextStyle(
+ color: AppColor.colorSubtitle,
+ fontSize: 15,
+ fontWeight: FontWeight.normal
+ ),
+ textAlign: TextAlign.center,
+ ),
+ )
+ ],
+ ),
+ height: MediaQuery.of(context).size.height,
),
- height: MediaQuery.of(_context).size.height,
- ),
- )
- ]
+ )
+ ]
+ ),
)
);
}
diff --git a/lib/features/search/presentation/search_email_view.dart b/lib/features/search/presentation/search_email_view.dart
index 4f51c66d9..f31c4d418 100644
--- a/lib/features/search/presentation/search_email_view.dart
+++ b/lib/features/search/presentation/search_email_view.dart
@@ -392,14 +392,11 @@ class SearchEmailView extends GetWidget
return Obx(() => controller.viewState.value.fold(
(failure) => const SizedBox.shrink(),
(success) => success is! SearchingState
- ? (BackgroundWidgetBuilder(context)
- ..image(SvgPicture.asset(
- _imagePaths.icEmptyImageDefault,
- width: 120,
- height: 120,
- fit: BoxFit.fill))
- ..text(AppLocalizations.of(context).no_emails_matching_your_search))
- .build()
+ ? BackgroundWidgetBuilder(
+ AppLocalizations.of(context).no_emails_matching_your_search,
+ controller.responsiveUtils,
+ iconSVG: _imagePaths.icEmptyEmail
+ )
: const SizedBox.shrink())
);
}
diff --git a/lib/features/thread/presentation/thread_view.dart b/lib/features/thread/presentation/thread_view.dart
index 9cfc450c5..8266ac524 100644
--- a/lib/features/thread/presentation/thread_view.dart
+++ b/lib/features/thread/presentation/thread_view.dart
@@ -289,7 +289,6 @@ class ThreadView extends GetWidget
padding: EdgeInsets.zero,
color: Colors.white,
child: Obx(() {
- log('ThreadView::_buildListEmail():');
return Visibility(
visible: controller.openingEmail.isFalse,
child: _buildResultListEmail(context, controller.mailboxDashBoardController.emailsInCurrentMailbox));
@@ -429,17 +428,37 @@ class ThreadView extends GetWidget
return Obx(() => controller.viewState.value.fold(
(failure) => const SizedBox.shrink(),
(success) => success is! LoadingState && success is! SearchingState
- ? (BackgroundWidgetBuilder(context)
- ..key(const Key('empty_email_background'))
- ..image(SvgPicture.asset(_imagePaths.icEmptyImageDefault, width: 120, height: 120, fit: BoxFit.fill))
- ..text(controller.isSearchActive()
- ? AppLocalizations.of(context).no_emails_matching_your_search
- : AppLocalizations.of(context).no_emails))
- .build()
+ ? BackgroundWidgetBuilder(
+ _getMessageEmptyEmail(context),
+ controller.responsiveUtils,
+ iconSVG: _imagePaths.icEmptyEmail,
+ subTitle: _getSubMessageEmptyEmail(context),
+ )
: const SizedBox.shrink())
);
}
+ String _getMessageEmptyEmail(BuildContext context) {
+ if (controller.isSearchActive()) {
+ return AppLocalizations.of(context).no_emails_matching_your_search;
+ } else {
+ if (controller.mailboxDashBoardController.filterMessageOption.value == FilterMessageOption.all) {
+ return AppLocalizations.of(context).noEmailInYourCurrentMailbox;
+ } else {
+ return AppLocalizations.of(context).noEmailMatchYourCurrentFilter;
+ }
+ }
+ }
+
+ String? _getSubMessageEmptyEmail(BuildContext context) {
+ if (!controller.isSearchActive()
+ && controller.mailboxDashBoardController.filterMessageOption.value != FilterMessageOption.all) {
+ return AppLocalizations.of(context).reduceSomeFiltersAndTryAgain;
+ } else {
+ return null;
+ }
+ }
+
bool supportEmptyTrash(BuildContext context) {
return controller.isMailboxTrash
&& controller.mailboxDashBoardController.emailsInCurrentMailbox.isNotEmpty
diff --git a/lib/l10n/intl_messages.arb b/lib/l10n/intl_messages.arb
index 655226e28..2b73fcf56 100644
--- a/lib/l10n/intl_messages.arb
+++ b/lib/l10n/intl_messages.arb
@@ -1,5 +1,5 @@
{
- "@@last_modified": "2023-01-16T10:06:45.070370",
+ "@@last_modified": "2023-01-27T17:10:17.205660",
"initializing_data": "Initializing data...",
"@initializing_data": {
"type": "text",
@@ -150,12 +150,6 @@
"placeholders_order": [],
"placeholders": {}
},
- "no_emails": "No emails in this mailbox",
- "@no_emails": {
- "type": "text",
- "placeholders_order": [],
- "placeholders": {}
- },
"no_mail_selected": "No email selected",
"@no_mail_selected": {
"type": "text",
@@ -2598,10 +2592,62 @@
"placeholders_order": [],
"placeholders": {}
},
+ "countNewSpamEmails": "You have {count} new spam emails!",
+ "@countNewSpamEmails": {
+ "type": "text",
+ "placeholders_order": [
+ "count"
+ ],
+ "placeholders": {
+ "count": {}
+ }
+ },
+ "showDetails": "Show Details",
+ "@showDetails": {
+ "type": "text",
+ "placeholders_order": [],
+ "placeholders": {}
+ },
+ "dismiss": "Dismiss",
+ "@dismiss": {
+ "type": "text",
+ "placeholders_order": [],
+ "placeholders": {}
+ },
+ "disableSpamReport": "Disable Spam report",
+ "@disableSpamReport": {
+ "type": "text",
+ "placeholders_order": [],
+ "placeholders": {}
+ },
+ "enableSpamReport": "Enable Spam report",
+ "@enableSpamReport": {
+ "type": "text",
+ "placeholders_order": [],
+ "placeholders": {}
+ },
"required": "required",
"@required": {
"type": "text",
"placeholders_order": [],
"placeholders": {}
+ },
+ "noEmailInYourCurrentMailbox": "We're sorry, there are no emails in your current mailbox",
+ "@noEmailInYourCurrentMailbox": {
+ "type": "text",
+ "placeholders_order": [],
+ "placeholders": {}
+ },
+ "noEmailMatchYourCurrentFilter": "We're sorry, there are no emails that match your current filter.",
+ "@noEmailMatchYourCurrentFilter": {
+ "type": "text",
+ "placeholders_order": [],
+ "placeholders": {}
+ },
+ "reduceSomeFiltersAndTryAgain": "Let's reduce some filters and try again",
+ "@reduceSomeFiltersAndTryAgain": {
+ "type": "text",
+ "placeholders_order": [],
+ "placeholders": {}
}
}
\ No newline at end of file
diff --git a/lib/main/localizations/app_localizations.dart b/lib/main/localizations/app_localizations.dart
index 98d80a791..2d13cc3e9 100644
--- a/lib/main/localizations/app_localizations.dart
+++ b/lib/main/localizations/app_localizations.dart
@@ -152,13 +152,6 @@ class AppLocalizations {
);
}
- String get no_emails {
- return Intl.message(
- 'No emails in this mailbox',
- name: 'no_emails',
- );
- }
-
String get no_mail_selected {
return Intl.message(
'No email selected',
@@ -2708,4 +2701,22 @@ class AppLocalizations {
'required',
name: 'required');
}
+
+ String get noEmailInYourCurrentMailbox {
+ return Intl.message(
+ 'We\'re sorry, there are no emails in your current mailbox',
+ name: 'noEmailInYourCurrentMailbox');
+ }
+
+ String get noEmailMatchYourCurrentFilter {
+ return Intl.message(
+ 'We\'re sorry, there are no emails that match your current filter.',
+ name: 'noEmailMatchYourCurrentFilter');
+ }
+
+ String get reduceSomeFiltersAndTryAgain {
+ return Intl.message(
+ 'Let\'s reduce some filters and try again',
+ name: 'reduceSomeFiltersAndTryAgain');
+ }
}
\ No newline at end of file