hotfix: Do not add Reply-To to recipients field collapsed when unfocus

(cherry picked from commit aa0c27ce1c9d7fdd579d0f25c6b7d8f4b50adf70)
This commit is contained in:
dab246
2025-10-10 15:28:23 +07:00
committed by Dat H. Pham
parent c9cb68f3ef
commit bddf29c604
4 changed files with 44 additions and 27 deletions
@@ -12,17 +12,25 @@ extension HandleRecipientsCollapsedExtensions on ComposerController {
listBccEmailAddress +
listReplyToEmailAddress;
List<EmailAddress> get listEmailAddressInvalid => allListEmailAddress
.where(
List<EmailAddress> get allListEmailAddressWithoutReplyTo =>
listToEmailAddress +
listCcEmailAddress +
listBccEmailAddress;
bool get existEmailAddressInvalid => allListEmailAddress
.any(
(emailAddress) => !EmailUtils.isEmailAddressValid(
emailAddress.emailAddress,
),
)
.toList();
);
bool get isRecipientsNotEmpty => listToEmailAddress.isNotEmpty ||
bool get isRecipientsWithoutReplyToNotEmpty => listToEmailAddress.isNotEmpty ||
listCcEmailAddress.isNotEmpty ||
listBccEmailAddress.isNotEmpty ||
listBccEmailAddress.isNotEmpty;
bool get isRecipientsEmptyExceptReplyTo => listToEmailAddress.isEmpty &&
listCcEmailAddress.isEmpty &&
listBccEmailAddress.isEmpty &&
listReplyToEmailAddress.isNotEmpty;
void showFullRecipients() {
@@ -90,7 +98,15 @@ extension HandleRecipientsCollapsedExtensions on ComposerController {
}
}
void hideAllRecipients() {
void triggerHideRecipientsFiledsWhenUnfocus() {
if (isRecipientsEmptyExceptReplyTo) {
hideAllRecipientsFieldsExceptTo();
} else if (isRecipientsWithoutReplyToNotEmpty) {
hideAllRecipientsFields();
}
}
void hideAllRecipientsFields() {
fromRecipientState.value = PrefixRecipientState.disabled;
toRecipientState.value = PrefixRecipientState.disabled;
ccRecipientState.value = PrefixRecipientState.disabled;
@@ -98,4 +114,13 @@ extension HandleRecipientsCollapsedExtensions on ComposerController {
replyToRecipientState.value = PrefixRecipientState.disabled;
recipientsCollapsedState.value = PrefixRecipientState.enabled;
}
void hideAllRecipientsFieldsExceptTo() {
toRecipientState.value = PrefixRecipientState.enabled;
fromRecipientState.value = PrefixRecipientState.disabled;
ccRecipientState.value = PrefixRecipientState.disabled;
bccRecipientState.value = PrefixRecipientState.disabled;
replyToRecipientState.value = PrefixRecipientState.disabled;
recipientsCollapsedState.value = PrefixRecipientState.disabled;
}
}