Fix display empty state when no favorites are available
This commit is contained in:
@@ -744,7 +744,8 @@ class ThreadView extends GetWidget<ThreadController>
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (success is GetAllEmailSuccess
|
if (success is GetAllEmailSuccess
|
||||||
&& success.currentMailboxId != controller.selectedMailboxId) {
|
&& success.currentMailboxId != controller.selectedMailboxId &&
|
||||||
|
controller.selectedMailbox?.isFavorite != true) {
|
||||||
return const SizedBox.shrink();
|
return const SizedBox.shrink();
|
||||||
} else {
|
} else {
|
||||||
return PullToRefreshWidget(
|
return PullToRefreshWidget(
|
||||||
@@ -759,6 +760,7 @@ class ThreadView extends GetWidget<ThreadController>
|
|||||||
isNetworkConnectionAvailable: controller.networkConnectionController.isNetworkConnectionAvailable(),
|
isNetworkConnectionAvailable: controller.networkConnectionController.isNetworkConnectionAvailable(),
|
||||||
isSearchActive: controller.isSearchActive,
|
isSearchActive: controller.isSearchActive,
|
||||||
isFilterMessageActive: controller.mailboxDashBoardController.filterMessageOption.value != FilterMessageOption.all,
|
isFilterMessageActive: controller.mailboxDashBoardController.filterMessageOption.value != FilterMessageOption.all,
|
||||||
|
isFavoriteFolder: controller.selectedMailbox?.isFavorite == true,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ class EmptyEmailsWidget extends StatelessWidget {
|
|||||||
final bool isSearchActive;
|
final bool isSearchActive;
|
||||||
final bool isFilterMessageActive;
|
final bool isFilterMessageActive;
|
||||||
final bool isNetworkConnectionAvailable;
|
final bool isNetworkConnectionAvailable;
|
||||||
|
final bool isFavoriteFolder;
|
||||||
|
|
||||||
final _responsiveUtils = Get.find<ResponsiveUtils>();
|
final _responsiveUtils = Get.find<ResponsiveUtils>();
|
||||||
final _imagePaths = Get.find<ImagePaths>();
|
final _imagePaths = Get.find<ImagePaths>();
|
||||||
@@ -22,6 +23,7 @@ class EmptyEmailsWidget extends StatelessWidget {
|
|||||||
this.isSearchActive = false,
|
this.isSearchActive = false,
|
||||||
this.isFilterMessageActive = false,
|
this.isFilterMessageActive = false,
|
||||||
this.isNetworkConnectionAvailable = true,
|
this.isNetworkConnectionAvailable = true,
|
||||||
|
this.isFavoriteFolder = false,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -43,7 +45,7 @@ class EmptyEmailsWidget extends StatelessWidget {
|
|||||||
padding: EmptyEmailsWidgetStyles.labelPadding,
|
padding: EmptyEmailsWidgetStyles.labelPadding,
|
||||||
child: Text(
|
child: Text(
|
||||||
key: const Key('empty_email_message'),
|
key: const Key('empty_email_message'),
|
||||||
_getMessageEmptyEmail(context),
|
_getMessageEmptyEmail(AppLocalizations.of(context)),
|
||||||
style: ThemeUtils.textStyleInter600(),
|
style: ThemeUtils.textStyleInter600(),
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
),
|
),
|
||||||
@@ -51,7 +53,7 @@ class EmptyEmailsWidget extends StatelessWidget {
|
|||||||
if (_showEmailSubMessage)
|
if (_showEmailSubMessage)
|
||||||
Text(
|
Text(
|
||||||
key: const Key('empty_email_sub_message'),
|
key: const Key('empty_email_sub_message'),
|
||||||
AppLocalizations.of(context).startToComposeEmails,
|
_getSubMessageEmptyEmail(AppLocalizations.of(context)),
|
||||||
style: ThemeUtils.textStyleInter400.copyWith(
|
style: ThemeUtils.textStyleInter400.copyWith(
|
||||||
letterSpacing: -0.15,
|
letterSpacing: -0.15,
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
@@ -76,21 +78,33 @@ class EmptyEmailsWidget extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool get _showEmailSubMessage => isNetworkConnectionAvailable &&
|
bool get _showEmailSubMessage =>
|
||||||
!isFilterMessageActive &&
|
(isNetworkConnectionAvailable &&
|
||||||
!isSearchActive;
|
!isFilterMessageActive &&
|
||||||
|
!isSearchActive) ||
|
||||||
|
(isFavoriteFolder && !isFilterMessageActive);
|
||||||
|
|
||||||
String _getMessageEmptyEmail(BuildContext context) {
|
String _getMessageEmptyEmail(AppLocalizations appLocalizations) {
|
||||||
if (!isNetworkConnectionAvailable) {
|
if (!isNetworkConnectionAvailable) {
|
||||||
return AppLocalizations.of(context).no_internet_connection_try_again_later;
|
return appLocalizations.no_internet_connection_try_again_later;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isSearchActive) {
|
if (isSearchActive) {
|
||||||
return AppLocalizations.of(context).no_emails_matching_your_search;
|
return appLocalizations.no_emails_matching_your_search;
|
||||||
} else if (isFilterMessageActive) {
|
} else if (isFilterMessageActive) {
|
||||||
return AppLocalizations.of(context).noEmailMatchYourCurrentFilter;
|
return appLocalizations.noEmailMatchYourCurrentFilter;
|
||||||
|
} else if (isFavoriteFolder) {
|
||||||
|
return appLocalizations.youDoNotHaveAnyFavoritesEmails;
|
||||||
} else {
|
} else {
|
||||||
return AppLocalizations.of(context).youDoNotHaveAnyEmailInYourCurrentFolder;
|
return appLocalizations.youDoNotHaveAnyEmailInYourCurrentFolder;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String _getSubMessageEmptyEmail(AppLocalizations appLocalizations) {
|
||||||
|
if (isFavoriteFolder) {
|
||||||
|
return appLocalizations.startToAddFavoritesEmails;
|
||||||
|
} else {
|
||||||
|
return appLocalizations.startToComposeEmails;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"@@last_modified": "2025-11-12T23:59:36.025917",
|
"@@last_modified": "2025-11-18T16:44:44.341535",
|
||||||
"initializing_data": "Initializing data...",
|
"initializing_data": "Initializing data...",
|
||||||
"@initializing_data": {
|
"@initializing_data": {
|
||||||
"type": "text",
|
"type": "text",
|
||||||
@@ -5117,5 +5117,17 @@
|
|||||||
"type": "text",
|
"type": "text",
|
||||||
"placeholders_order": [],
|
"placeholders_order": [],
|
||||||
"placeholders": {}
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"youDoNotHaveAnyFavoritesEmails": "You don’t have any favorites emails.",
|
||||||
|
"@youDoNotHaveAnyFavoritesEmails": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders_order": [],
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"startToAddFavoritesEmails": "Start to add favorites emails",
|
||||||
|
"@startToAddFavoritesEmails": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders_order": [],
|
||||||
|
"placeholders": {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5422,4 +5422,18 @@ class AppLocalizations {
|
|||||||
name: 'manageYourTwakeAccount',
|
name: 'manageYourTwakeAccount',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String get youDoNotHaveAnyFavoritesEmails {
|
||||||
|
return Intl.message(
|
||||||
|
'You don’t have any favorites emails.',
|
||||||
|
name: 'youDoNotHaveAnyFavoritesEmails',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
String get startToAddFavoritesEmails {
|
||||||
|
return Intl.message(
|
||||||
|
'Start to add favorites emails',
|
||||||
|
name: 'startToAddFavoritesEmails',
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user