TF-355 Fix the empty mailbox message not correct when filtering

This commit is contained in:
dab246
2023-01-27 17:11:44 +07:00
committed by Dat Vu
parent 16d360bb00
commit c51ece70f2
9 changed files with 265 additions and 83 deletions
@@ -392,14 +392,11 @@ class SearchEmailView extends GetWidget<SearchEmailController>
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())
);
}
@@ -289,7 +289,6 @@ class ThreadView extends GetWidget<ThreadController>
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<ThreadController>
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
+53 -7
View File
@@ -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": {}
}
}
+18 -7
View File
@@ -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');
}
}