TF-105 [BUG] Fix no subject should show empty instead of null

This commit is contained in:
dab246
2021-10-12 00:56:22 +07:00
committed by Dat H. Pham
parent a282c8b281
commit b60656b70f
4 changed files with 7 additions and 12 deletions
@@ -129,7 +129,7 @@ class ComposerController extends BaseController {
&& composerArguments.value?.presentationEmail != null && composerArguments.value?.presentationEmail != null
&& Get.context != null) { && Get.context != null) {
final subject = '${composerArguments.value!.emailActionType.prefixSubjectComposer(Get.context!)} ' final subject = '${composerArguments.value!.emailActionType.prefixSubjectComposer(Get.context!)} '
'${composerArguments.value!.presentationEmail?.subject}'; '${composerArguments.value!.presentationEmail?.getEmailTitle()}';
setSubjectEmail(subject); setSubjectEmail(subject);
subjectEmailInputController.text = subject; subjectEmailInputController.text = subject;
} }
@@ -117,7 +117,7 @@ class EmailView extends GetView {
return Padding( return Padding(
padding: EdgeInsets.only(left: 8, top: 4, bottom: 16), padding: EdgeInsets.only(left: 8, top: 4, bottom: 16),
child: Text( child: Text(
'${emailController.mailboxDashBoardController.selectedEmail.value?.subject}', '${emailController.mailboxDashBoardController.selectedEmail.value?.getEmailTitle()}',
style: TextStyle(fontSize: 18, color: AppColor.mailboxTextColor, fontWeight: FontWeight.w500) style: TextStyle(fontSize: 18, color: AppColor.mailboxTextColor, fontWeight: FontWeight.w500)
)); ));
} }
+3 -8
View File
@@ -44,12 +44,7 @@ class PresentationEmail with EquatableMixin {
} }
); );
String getSenderName() { String getSenderName() => from?.first.asString() ?? '';
if (from != null && from!.isNotEmpty) {
return from!.first.asString();
}
return '';
}
String getAvatarText() { String getAvatarText() {
if (getSenderName().isNotEmpty) { if (getSenderName().isNotEmpty) {
@@ -58,9 +53,9 @@ class PresentationEmail with EquatableMixin {
return ''; return '';
} }
String getEmailTitle() => subject != null ? subject! : ''; String getEmailTitle() => subject ?? '';
String getPartialContent() => preview != null ? preview! : ''; String getPartialContent() => preview ?? '';
bool isUnReadEmail() => !(keywords?.containsKey(KeyWordIdentifier.emailSeen) == true); bool isUnReadEmail() => !(keywords?.containsKey(KeyWordIdentifier.emailSeen) == true);
@@ -28,9 +28,9 @@ extension EmailAddressExtension on EmailAddress {
return ''; return '';
} }
String get emailAddress => email != null ? email! : ''; String get emailAddress => email ?? '';
String get displayName => name != null ? name! : ''; String get displayName => name ?? '';
EmailAddressCache toEmailAddressCache() => EmailAddressCache(displayName, emailAddress); EmailAddressCache toEmailAddressCache() => EmailAddressCache(displayName, emailAddress);
} }