diff --git a/lib/features/composer/presentation/composer_controller.dart b/lib/features/composer/presentation/composer_controller.dart index 0c2104877..251946354 100644 --- a/lib/features/composer/presentation/composer_controller.dart +++ b/lib/features/composer/presentation/composer_controller.dart @@ -129,7 +129,7 @@ class ComposerController extends BaseController { && composerArguments.value?.presentationEmail != null && Get.context != null) { final subject = '${composerArguments.value!.emailActionType.prefixSubjectComposer(Get.context!)} ' - '${composerArguments.value!.presentationEmail?.subject}'; + '${composerArguments.value!.presentationEmail?.getEmailTitle()}'; setSubjectEmail(subject); subjectEmailInputController.text = subject; } diff --git a/lib/features/email/presentation/email_view.dart b/lib/features/email/presentation/email_view.dart index 0f418a1f5..1d2c18041 100644 --- a/lib/features/email/presentation/email_view.dart +++ b/lib/features/email/presentation/email_view.dart @@ -117,7 +117,7 @@ class EmailView extends GetView { return Padding( padding: EdgeInsets.only(left: 8, top: 4, bottom: 16), child: Text( - '${emailController.mailboxDashBoardController.selectedEmail.value?.subject}', + '${emailController.mailboxDashBoardController.selectedEmail.value?.getEmailTitle()}', style: TextStyle(fontSize: 18, color: AppColor.mailboxTextColor, fontWeight: FontWeight.w500) )); } diff --git a/model/lib/email/presentation_email.dart b/model/lib/email/presentation_email.dart index 419dc7eb7..a90a54723 100644 --- a/model/lib/email/presentation_email.dart +++ b/model/lib/email/presentation_email.dart @@ -44,12 +44,7 @@ class PresentationEmail with EquatableMixin { } ); - String getSenderName() { - if (from != null && from!.isNotEmpty) { - return from!.first.asString(); - } - return ''; - } + String getSenderName() => from?.first.asString() ?? ''; String getAvatarText() { if (getSenderName().isNotEmpty) { @@ -58,9 +53,9 @@ class PresentationEmail with EquatableMixin { return ''; } - String getEmailTitle() => subject != null ? subject! : ''; + String getEmailTitle() => subject ?? ''; - String getPartialContent() => preview != null ? preview! : ''; + String getPartialContent() => preview ?? ''; bool isUnReadEmail() => !(keywords?.containsKey(KeyWordIdentifier.emailSeen) == true); diff --git a/model/lib/extensions/email_address_extension.dart b/model/lib/extensions/email_address_extension.dart index 1a97c3c08..9750a2180 100644 --- a/model/lib/extensions/email_address_extension.dart +++ b/model/lib/extensions/email_address_extension.dart @@ -28,9 +28,9 @@ extension EmailAddressExtension on EmailAddress { 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); } \ No newline at end of file