diff --git a/lib/features/base/key_values/email_details_key_values.dart b/lib/features/base/key_values/email_details_key_values.dart new file mode 100644 index 0000000000..3b84b858b4 --- /dev/null +++ b/lib/features/base/key_values/email_details_key_values.dart @@ -0,0 +1,8 @@ +class EmailDetailsKeyValues { + static const String emailDetails = 'tmail_email_details'; + static const String subject = 'tmail_email_details_subject'; + static const String sender = 'tmail_email_details_sender'; + static const String senderEmail = 'tmail_email_details_sender_email'; + static const String recipient = 'tmail_email_details_recipient'; + // find email content with html "iframe" +} \ No newline at end of file diff --git a/lib/features/base/key_values/email_tile_key_values.dart b/lib/features/base/key_values/email_tile_key_values.dart new file mode 100644 index 0000000000..cb2e9b2576 --- /dev/null +++ b/lib/features/base/key_values/email_tile_key_values.dart @@ -0,0 +1,6 @@ +class EmailTileKeyValues { + static const String emailTile = 'tmail_email_tile'; + static const String sender = 'tmail_email_tile_sender'; + static const String subject = 'tmail_email_tile_subject'; + static const String preview = 'tmail_email_tile_preview'; +} \ No newline at end of file diff --git a/lib/features/email/presentation/email_view.dart b/lib/features/email/presentation/email_view.dart index 9f150b1fa7..7361383baf 100644 --- a/lib/features/email/presentation/email_view.dart +++ b/lib/features/email/presentation/email_view.dart @@ -15,6 +15,7 @@ import 'package:model/extensions/presentation_email_extension.dart'; import 'package:model/extensions/presentation_mailbox_extension.dart'; import 'package:model/mailbox/presentation_mailbox.dart'; import 'package:pointer_interceptor/pointer_interceptor.dart'; +import 'package:tmail_ui_user/features/base/key_values/email_details_key_values.dart'; import 'package:tmail_ui_user/features/base/widget/popup_item_widget.dart'; import 'package:tmail_ui_user/features/composer/presentation/extensions/email_action_type_extension.dart'; import 'package:tmail_ui_user/features/email/presentation/controller/single_email_controller.dart'; @@ -77,174 +78,177 @@ class EmailView extends GetWidget { right: controller.responsiveUtils.isLandscapeMobile(context), left: controller.responsiveUtils.isLandscapeMobile(context), bottom: !PlatformInfo.isIOS, - child: Container( - clipBehavior: Clip.antiAlias, - decoration: controller.responsiveUtils.isWebDesktop(context) - ? BoxDecoration( - borderRadius: BorderRadius.circular(20), - border: Border.all(color: AppColor.colorBorderBodyThread, width: 1), - color: Colors.white) - : const BoxDecoration(color: Colors.white), - margin: _getMarginEmailView(context), - child: Obx(() { - final currentEmail = controller.currentEmail; - if (currentEmail != null) { - return Column(children: [ - if (!PlatformInfo.isIOS) - Obx(() => EmailViewAppBarWidget( - key: const Key('email_view_app_bar_widget'), - presentationEmail: currentEmail, - mailboxContain: _getMailboxContain(currentEmail), - isSearchActivated: controller.mailboxDashBoardController.searchController.isSearchEmailRunning, - onBackAction: () => controller.closeEmailView(context: context), - onEmailActionClick: (email, action) => controller.handleEmailAction(context, email, action), - onMoreActionClick: (presentationEmail, position) => _handleMoreEmailAction(context: context, presentationEmail: presentationEmail, position: position), - optionsWidget: PlatformInfo.isWeb && controller.emailSupervisorController.supportedPageView.isTrue - ? _buildNavigatorPageViewWidgets(context) - : null, - )), - Obx(() { - final vacation = controller.mailboxDashBoardController.vacationResponse.value; - if (vacation?.vacationResponderIsValid == true && - ( - controller.responsiveUtils.isMobile(context) || - controller.responsiveUtils.isTablet(context) || - controller.responsiveUtils.isLandscapeMobile(context) - ) - ) { - return VacationNotificationMessageWidget( - margin: const EdgeInsetsDirectional.only(start: 12, end: 12, top: 8), - vacationResponse: vacation!, - actionGotoVacationSetting: controller.mailboxDashBoardController.goToVacationSetting, - actionEndNow: controller.mailboxDashBoardController.disableVacationResponder - ); - } else { - return const SizedBox.shrink(); - } - }), - Expanded( - child: LayoutBuilder(builder: (context, constraints) { - return Obx(() { - bool supportedPageView = controller.emailSupervisorController.supportedPageView.isTrue && PlatformInfo.isMobile; - final currentListEmail = controller.emailSupervisorController.currentListEmail; - - if (supportedPageView) { - return PageView.builder( - physics: controller.emailSupervisorController.scrollPhysicsPageView.value, - itemCount: currentListEmail.length, - allowImplicitScrolling: true, - controller: controller.emailSupervisorController.pageController, - onPageChanged: controller.emailSupervisorController.onPageChanged, - itemBuilder: (context, index) { - final currentEmail = currentListEmail[index]; - if (PlatformInfo.isMobile) { - return SingleChildScrollView( - physics : const ClampingScrollPhysics(), - child: Container( - width: double.infinity, - alignment: Alignment.center, - color: Colors.white, - child: Obx(() => _buildEmailMessage( - context: context, - presentationEmail: currentEmail, - calendarEvent: controller.calendarEvent, - maxBodyHeight: constraints.maxHeight - )) - ) - ); - } else { - return Obx(() { - final calendarEvent = controller.calendarEvent; - if (currentEmail.hasCalendarEvent && calendarEvent != null) { - return Padding( - padding: const EdgeInsetsDirectional.symmetric(horizontal: 4), - child: SingleChildScrollView( - physics : const ClampingScrollPhysics(), - child: Container( - width: double.infinity, - alignment: Alignment.center, - color: Colors.white, - child: _buildEmailMessage( - context: context, - presentationEmail: currentEmail, - calendarEvent: calendarEvent, - emailAddressSender: currentEmail.listEmailAddressSender.getListAddress(), - ) - ) - ), - ); - } else { - return _buildEmailMessage( - context: context, - presentationEmail: currentEmail, - maxBodyHeight: constraints.maxHeight - ); - } - }); - } - } - ); - } else { - if (PlatformInfo.isMobile) { - return SingleChildScrollView( - physics : const ClampingScrollPhysics(), - child: Container( - width: double.infinity, - alignment: Alignment.center, - color: Colors.white, - child: Obx(() => _buildEmailMessage( - context: context, - presentationEmail: currentEmail, - calendarEvent: controller.calendarEvent, - maxBodyHeight: constraints.maxHeight - )) - ) - ); - } else { - return Obx(() { - final calendarEvent = controller.calendarEvent; - if (currentEmail.hasCalendarEvent && calendarEvent != null) { - return Padding( - padding: const EdgeInsetsDirectional.symmetric(horizontal: 4), - child: SingleChildScrollView( + child: Semantics( + identifier: EmailDetailsKeyValues.emailDetails, + child: Container( + clipBehavior: Clip.antiAlias, + decoration: controller.responsiveUtils.isWebDesktop(context) + ? BoxDecoration( + borderRadius: BorderRadius.circular(20), + border: Border.all(color: AppColor.colorBorderBodyThread, width: 1), + color: Colors.white) + : const BoxDecoration(color: Colors.white), + margin: _getMarginEmailView(context), + child: Obx(() { + final currentEmail = controller.currentEmail; + if (currentEmail != null) { + return Column(children: [ + if (!PlatformInfo.isIOS) + Obx(() => EmailViewAppBarWidget( + key: const Key('email_view_app_bar_widget'), + presentationEmail: currentEmail, + mailboxContain: _getMailboxContain(currentEmail), + isSearchActivated: controller.mailboxDashBoardController.searchController.isSearchEmailRunning, + onBackAction: () => controller.closeEmailView(context: context), + onEmailActionClick: (email, action) => controller.handleEmailAction(context, email, action), + onMoreActionClick: (presentationEmail, position) => _handleMoreEmailAction(context: context, presentationEmail: presentationEmail, position: position), + optionsWidget: PlatformInfo.isWeb && controller.emailSupervisorController.supportedPageView.isTrue + ? _buildNavigatorPageViewWidgets(context) + : null, + )), + Obx(() { + final vacation = controller.mailboxDashBoardController.vacationResponse.value; + if (vacation?.vacationResponderIsValid == true && + ( + controller.responsiveUtils.isMobile(context) || + controller.responsiveUtils.isTablet(context) || + controller.responsiveUtils.isLandscapeMobile(context) + ) + ) { + return VacationNotificationMessageWidget( + margin: const EdgeInsetsDirectional.only(start: 12, end: 12, top: 8), + vacationResponse: vacation!, + actionGotoVacationSetting: controller.mailboxDashBoardController.goToVacationSetting, + actionEndNow: controller.mailboxDashBoardController.disableVacationResponder + ); + } else { + return const SizedBox.shrink(); + } + }), + Expanded( + child: LayoutBuilder(builder: (context, constraints) { + return Obx(() { + bool supportedPageView = controller.emailSupervisorController.supportedPageView.isTrue && PlatformInfo.isMobile; + final currentListEmail = controller.emailSupervisorController.currentListEmail; + + if (supportedPageView) { + return PageView.builder( + physics: controller.emailSupervisorController.scrollPhysicsPageView.value, + itemCount: currentListEmail.length, + allowImplicitScrolling: true, + controller: controller.emailSupervisorController.pageController, + onPageChanged: controller.emailSupervisorController.onPageChanged, + itemBuilder: (context, index) { + final currentEmail = currentListEmail[index]; + if (PlatformInfo.isMobile) { + return SingleChildScrollView( physics : const ClampingScrollPhysics(), child: Container( width: double.infinity, alignment: Alignment.center, color: Colors.white, - child: _buildEmailMessage( + child: Obx(() => _buildEmailMessage( context: context, presentationEmail: currentEmail, - calendarEvent: calendarEvent, - emailAddressSender: currentEmail.listEmailAddressSender.getListAddress(), + calendarEvent: controller.calendarEvent, maxBodyHeight: constraints.maxHeight - ) + )) ) - ), - ); - } else { - return _buildEmailMessage( - context: context, - presentationEmail: currentEmail, - maxBodyHeight: constraints.maxHeight - ); + ); + } else { + return Obx(() { + final calendarEvent = controller.calendarEvent; + if (currentEmail.hasCalendarEvent && calendarEvent != null) { + return Padding( + padding: const EdgeInsetsDirectional.symmetric(horizontal: 4), + child: SingleChildScrollView( + physics : const ClampingScrollPhysics(), + child: Container( + width: double.infinity, + alignment: Alignment.center, + color: Colors.white, + child: _buildEmailMessage( + context: context, + presentationEmail: currentEmail, + calendarEvent: calendarEvent, + emailAddressSender: currentEmail.listEmailAddressSender.getListAddress(), + ) + ) + ), + ); + } else { + return _buildEmailMessage( + context: context, + presentationEmail: currentEmail, + maxBodyHeight: constraints.maxHeight + ); + } + }); + } } - }); + ); + } else { + if (PlatformInfo.isMobile) { + return SingleChildScrollView( + physics : const ClampingScrollPhysics(), + child: Container( + width: double.infinity, + alignment: Alignment.center, + color: Colors.white, + child: Obx(() => _buildEmailMessage( + context: context, + presentationEmail: currentEmail, + calendarEvent: controller.calendarEvent, + maxBodyHeight: constraints.maxHeight + )) + ) + ); + } else { + return Obx(() { + final calendarEvent = controller.calendarEvent; + if (currentEmail.hasCalendarEvent && calendarEvent != null) { + return Padding( + padding: const EdgeInsetsDirectional.symmetric(horizontal: 4), + child: SingleChildScrollView( + physics : const ClampingScrollPhysics(), + child: Container( + width: double.infinity, + alignment: Alignment.center, + color: Colors.white, + child: _buildEmailMessage( + context: context, + presentationEmail: currentEmail, + calendarEvent: calendarEvent, + emailAddressSender: currentEmail.listEmailAddressSender.getListAddress(), + maxBodyHeight: constraints.maxHeight + ) + ) + ), + ); + } else { + return _buildEmailMessage( + context: context, + presentationEmail: currentEmail, + maxBodyHeight: constraints.maxHeight + ); + } + }); + } } - } - }); - }), - ), - EmailViewBottomBarWidget( - key: const Key('email_view_button_bar'), - presentationEmail: currentEmail, - emailActionCallback: controller.pressEmailAction - ), - ]); - } else { - return const EmailViewEmptyWidget(); - } - }) + }); + }), + ), + EmailViewBottomBarWidget( + key: const Key('email_view_button_bar'), + presentationEmail: currentEmail, + emailActionCallback: controller.pressEmailAction + ), + ]); + } else { + return const EmailViewEmptyWidget(); + } + }) + ), ) ) ), diff --git a/lib/features/email/presentation/widgets/email_receiver_widget.dart b/lib/features/email/presentation/widgets/email_receiver_widget.dart index 636caaf1c5..8278867728 100644 --- a/lib/features/email/presentation/widgets/email_receiver_widget.dart +++ b/lib/features/email/presentation/widgets/email_receiver_widget.dart @@ -13,6 +13,7 @@ import 'package:model/email/presentation_email.dart'; import 'package:model/extensions/email_address_extension.dart'; import 'package:model/extensions/list_email_address_extension.dart'; import 'package:model/extensions/presentation_email_extension.dart'; +import 'package:tmail_ui_user/features/base/key_values/email_details_key_values.dart'; import 'package:tmail_ui_user/features/composer/presentation/extensions/prefix_email_address_extension.dart'; import 'package:tmail_ui_user/features/email/presentation/widgets/email_sender_builder.dart'; import 'package:tmail_ui_user/features/email/presentation/widgets/prefix_recipient_widget.dart'; @@ -231,18 +232,21 @@ class _EmailReceiverWidgetState extends State { List _buildRecipientsTag({required List listEmailAddress}) { return listEmailAddress - .mapIndexed((index, emailAddress) => TMailButtonWidget.fromText( - text: index == listEmailAddress.length - 1 - ? emailAddress.asString() - : '${emailAddress.asString()},', - textStyle: Theme.of(context).textTheme.labelSmall?.copyWith( - color: Colors.black, - fontSize: 16, + .mapIndexed((index, emailAddress) => Semantics( + identifier: EmailDetailsKeyValues.recipient, + child: TMailButtonWidget.fromText( + text: index == listEmailAddress.length - 1 + ? emailAddress.asString() + : '${emailAddress.asString()},', + textStyle: Theme.of(context).textTheme.labelSmall?.copyWith( + color: Colors.black, + fontSize: 16, + ), + padding: const EdgeInsetsDirectional.symmetric(vertical: 5, horizontal: 8), + backgroundColor: Colors.transparent, + onTapActionCallback: () => widget.openEmailAddressDetailAction?.call(context, emailAddress), + onLongPressActionCallback: () => AppUtils.copyEmailAddressToClipboard(context, emailAddress.emailAddress), ), - padding: const EdgeInsetsDirectional.symmetric(vertical: 5, horizontal: 8), - backgroundColor: Colors.transparent, - onTapActionCallback: () => widget.openEmailAddressDetailAction?.call(context, emailAddress), - onLongPressActionCallback: () => AppUtils.copyEmailAddressToClipboard(context, emailAddress.emailAddress), )) .toList(); } diff --git a/lib/features/email/presentation/widgets/email_sender_builder.dart b/lib/features/email/presentation/widgets/email_sender_builder.dart index 70a399e73f..c9b707ae36 100644 --- a/lib/features/email/presentation/widgets/email_sender_builder.dart +++ b/lib/features/email/presentation/widgets/email_sender_builder.dart @@ -4,6 +4,7 @@ import 'package:core/presentation/utils/style_utils.dart'; import 'package:flutter/material.dart'; import 'package:jmap_dart_client/jmap/mail/email/email_address.dart'; import 'package:model/extensions/email_address_extension.dart'; +import 'package:tmail_ui_user/features/base/key_values/email_details_key_values.dart'; import 'package:tmail_ui_user/features/base/widget/material_text_button.dart'; import 'package:tmail_ui_user/main/utils/app_utils.dart'; @@ -30,35 +31,41 @@ class EmailSenderBuilder extends StatelessWidget { mainAxisSize: MainAxisSize.min, children: [ if (emailAddress.displayName.isNotEmpty) - MaterialTextButton( - label: emailAddress.displayName, - onTap: () => openEmailAddressDetailAction?.call(context, emailAddress), - onLongPress: () { - AppUtils.copyEmailAddressToClipboard(context, emailAddress.emailAddress); - }, - borderRadius: 8, - padding: const EdgeInsets.all(3), - labelSize: 20, - labelColor: Colors.black, - labelWeight: FontWeight.bold, - overflow: CommonTextStyle.defaultTextOverFlow, - softWrap: CommonTextStyle.defaultSoftWrap + Semantics( + identifier: EmailDetailsKeyValues.sender, + child: MaterialTextButton( + label: emailAddress.displayName, + onTap: () => openEmailAddressDetailAction?.call(context, emailAddress), + onLongPress: () { + AppUtils.copyEmailAddressToClipboard(context, emailAddress.emailAddress); + }, + borderRadius: 8, + padding: const EdgeInsets.all(3), + labelSize: 20, + labelColor: Colors.black, + labelWeight: FontWeight.bold, + overflow: CommonTextStyle.defaultTextOverFlow, + softWrap: CommonTextStyle.defaultSoftWrap + ), ), Padding( padding: const EdgeInsets.only(top: 2), - child: MaterialTextButton( - label: '<${emailAddress.emailAddress}>', - onTap: () => openEmailAddressDetailAction?.call(context, emailAddress), - onLongPress: () { - AppUtils.copyEmailAddressToClipboard(context, emailAddress.emailAddress); - }, - borderRadius: 8, - padding: const EdgeInsets.all(3), - labelSize: 16, - labelColor: AppColor.colorEmailAddressFull, - labelWeight: FontWeight.w500, - overflow: CommonTextStyle.defaultTextOverFlow, - softWrap: CommonTextStyle.defaultSoftWrap + child: Semantics( + identifier: EmailDetailsKeyValues.senderEmail, + child: MaterialTextButton( + label: '<${emailAddress.emailAddress}>', + onTap: () => openEmailAddressDetailAction?.call(context, emailAddress), + onLongPress: () { + AppUtils.copyEmailAddressToClipboard(context, emailAddress.emailAddress); + }, + borderRadius: 8, + padding: const EdgeInsets.all(3), + labelSize: 16, + labelColor: AppColor.colorEmailAddressFull, + labelWeight: FontWeight.w500, + overflow: CommonTextStyle.defaultTextOverFlow, + softWrap: CommonTextStyle.defaultSoftWrap + ), ), ) ] diff --git a/lib/features/email/presentation/widgets/email_subject_widget.dart b/lib/features/email/presentation/widgets/email_subject_widget.dart index 6132c433c6..94a9592907 100644 --- a/lib/features/email/presentation/widgets/email_subject_widget.dart +++ b/lib/features/email/presentation/widgets/email_subject_widget.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:model/email/presentation_email.dart'; +import 'package:tmail_ui_user/features/base/key_values/email_details_key_values.dart'; import 'package:tmail_ui_user/features/email/presentation/styles/email_subject_styles.dart'; class EmailSubjectWidget extends StatelessWidget { @@ -12,14 +13,18 @@ class EmailSubjectWidget extends StatelessWidget { Widget build(BuildContext context) { return Padding( padding: EmailSubjectStyles.padding, - child: Text( - presentationEmail.getEmailTitle(), - maxLines: EmailSubjectStyles.maxLines, - style: const TextStyle( - fontSize: EmailSubjectStyles.textSize, - color: EmailSubjectStyles.textColor, - fontWeight: EmailSubjectStyles.fontWeight - ) + child: Semantics( + identifier: EmailDetailsKeyValues.subject, + container: true, + child: Text( + presentationEmail.getEmailTitle(), + maxLines: EmailSubjectStyles.maxLines, + style: const TextStyle( + fontSize: EmailSubjectStyles.textSize, + color: EmailSubjectStyles.textColor, + fontWeight: EmailSubjectStyles.fontWeight + ) + ), ) ); } diff --git a/lib/features/thread/presentation/mixin/base_email_item_tile.dart b/lib/features/thread/presentation/mixin/base_email_item_tile.dart index 493bac458d..0e383b562a 100644 --- a/lib/features/thread/presentation/mixin/base_email_item_tile.dart +++ b/lib/features/thread/presentation/mixin/base_email_item_tile.dart @@ -14,6 +14,7 @@ import 'package:model/email/presentation_email.dart'; import 'package:model/extensions/presentation_email_extension.dart'; import 'package:model/extensions/presentation_mailbox_extension.dart'; import 'package:model/mailbox/presentation_mailbox.dart'; +import 'package:tmail_ui_user/features/base/key_values/email_tile_key_values.dart'; import 'package:tmail_ui_user/features/mailbox/presentation/extensions/presentation_mailbox_extension.dart'; import 'package:tmail_ui_user/features/thread/domain/model/search_query.dart'; import 'package:tmail_ui_user/features/thread/presentation/styles/item_email_tile_styles.dart'; @@ -85,29 +86,37 @@ mixin BaseEmailItemTile { SearchQuery? query ) { if (isSearchEnabled(isSearchEmailRunning, query)) { - return RichTextBuilder( - textOrigin: informationSender(email, mailbox), - wordToStyle: query?.value ?? '', - styleOrigin: TextStyle( - fontSize: 15, - color: buildTextColorForReadEmail(email), - fontWeight: buildFontForReadEmail(email) + return Semantics( + identifier: EmailTileKeyValues.sender, + container: true, + child: RichTextBuilder( + textOrigin: informationSender(email, mailbox), + wordToStyle: query?.value ?? '', + styleOrigin: TextStyle( + fontSize: 15, + color: buildTextColorForReadEmail(email), + fontWeight: buildFontForReadEmail(email) + ), + styleWord: TextStyle( + fontSize: 15, + color: buildTextColorForReadEmail(email), + backgroundColor: AppColor.bgWordSearch, + fontWeight: buildFontForReadEmail(email) + ) ), - styleWord: TextStyle( - fontSize: 15, - color: buildTextColorForReadEmail(email), - backgroundColor: AppColor.bgWordSearch, - fontWeight: buildFontForReadEmail(email) - ) ); } else { - return TextOverflowBuilder( - informationSender(email, mailbox), - style: TextStyle( - fontSize: 15, - overflow: CommonTextStyle.defaultTextOverFlow, - color: buildTextColorForReadEmail(email), - fontWeight: buildFontForReadEmail(email)) + return Semantics( + identifier: EmailTileKeyValues.sender, + container: true, + child: TextOverflowBuilder( + informationSender(email, mailbox), + style: TextStyle( + fontSize: 15, + overflow: CommonTextStyle.defaultTextOverFlow, + color: buildTextColorForReadEmail(email), + fontWeight: buildFontForReadEmail(email)) + ), ); } } @@ -152,27 +161,35 @@ mixin BaseEmailItemTile { SearchQuery? query ) { if (isSearchEnabled(isSearchEmailRunning, query)) { - return RichTextBuilder( - textOrigin: email.getPartialContent(), - wordToStyle: query?.value ?? '', - styleOrigin: const TextStyle( - fontSize: 13, - color: AppColor.colorContentEmail, - fontWeight: FontWeight.normal + return Semantics( + identifier: EmailTileKeyValues.preview, + container: true, + child: RichTextBuilder( + textOrigin: email.getPartialContent(), + wordToStyle: query?.value ?? '', + styleOrigin: const TextStyle( + fontSize: 13, + color: AppColor.colorContentEmail, + fontWeight: FontWeight.normal + ), + styleWord: const TextStyle( + fontSize: 13, + color: AppColor.colorContentEmail, + backgroundColor: AppColor.bgWordSearch + ) ), - styleWord: const TextStyle( - fontSize: 13, - color: AppColor.colorContentEmail, - backgroundColor: AppColor.bgWordSearch - ) ); } else { - return TextOverflowBuilder( - email.getPartialContent(), - style: const TextStyle( - fontSize: 13, - color: AppColor.colorContentEmail, - fontWeight: FontWeight.normal) + return Semantics( + identifier: EmailTileKeyValues.preview, + container: true, + child: TextOverflowBuilder( + email.getPartialContent(), + style: const TextStyle( + fontSize: 13, + color: AppColor.colorContentEmail, + fontWeight: FontWeight.normal) + ), ); } } diff --git a/lib/features/thread/presentation/widgets/email_tile_web_builder.dart b/lib/features/thread/presentation/widgets/email_tile_web_builder.dart index abb8241a4a..2910f36542 100644 --- a/lib/features/thread/presentation/widgets/email_tile_web_builder.dart +++ b/lib/features/thread/presentation/widgets/email_tile_web_builder.dart @@ -10,6 +10,7 @@ import 'package:model/email/presentation_email.dart'; import 'package:model/extensions/presentation_mailbox_extension.dart'; import 'package:model/mailbox/presentation_mailbox.dart'; import 'package:model/mailbox/select_mode.dart'; +import 'package:tmail_ui_user/features/base/key_values/email_tile_key_values.dart'; import 'package:tmail_ui_user/features/thread/domain/model/search_query.dart'; import 'package:tmail_ui_user/features/thread/presentation/mixin/base_email_item_tile.dart'; import 'package:tmail_ui_user/main/localizations/app_localizations.dart'; @@ -317,149 +318,152 @@ class _EmailTileBuilderState extends State with BaseEmailItem ), ), ), - desktop: Padding( - padding: const EdgeInsetsDirectional.only( - top: 2, - start: 3, - end: 3, - ), - child: Material( - type: MaterialType.transparency, - child: InkWell( - onTap: () => widget.emailActionClick?.call( - EmailActionType.preview, - widget.presentationEmail - ), - onHover: (value) => _hoverNotifier.value = value, - hoverColor: AppColor.colorEmailTileHoverWeb, - borderRadius: const BorderRadius.all(Radius.circular(14)), - child: Container( - padding: widget.padding ?? _getPaddingItem(context), - decoration: _getDecorationItem(), - alignment: Alignment.center, - child: Row(children: [ - const SizedBox(width: 10), - buildIconWeb( - icon: ValueListenableBuilder( - valueListenable: _hoverNotifier, - builder: (context, isHovered, child) { - return SvgPicture.asset( - widget.presentationEmail.isSelected - ? imagePaths.icCheckboxSelected - : imagePaths.icCheckboxUnselected, - colorFilter: ColorFilter.mode( - isHovered || widget.presentationEmail.isSelected - ? AppColor.primaryColor - : AppColor.colorEmailTileCheckboxUnhover, - BlendMode.srcIn), - width: 20, - height: 20); + desktop: Semantics( + identifier: EmailTileKeyValues.emailTile, + child: Padding( + padding: const EdgeInsetsDirectional.only( + top: 2, + start: 3, + end: 3, + ), + child: Material( + type: MaterialType.transparency, + child: InkWell( + onTap: () => widget.emailActionClick?.call( + EmailActionType.preview, + widget.presentationEmail + ), + onHover: (value) => _hoverNotifier.value = value, + hoverColor: AppColor.colorEmailTileHoverWeb, + borderRadius: const BorderRadius.all(Radius.circular(14)), + child: Container( + padding: widget.padding ?? _getPaddingItem(context), + decoration: _getDecorationItem(), + alignment: Alignment.center, + child: Row(children: [ + const SizedBox(width: 10), + buildIconWeb( + icon: ValueListenableBuilder( + valueListenable: _hoverNotifier, + builder: (context, isHovered, child) { + return SvgPicture.asset( + widget.presentationEmail.isSelected + ? imagePaths.icCheckboxSelected + : imagePaths.icCheckboxUnselected, + colorFilter: ColorFilter.mode( + isHovered || widget.presentationEmail.isSelected + ? AppColor.primaryColor + : AppColor.colorEmailTileCheckboxUnhover, + BlendMode.srcIn), + width: 20, + height: 20); + }, + ), + margin: const EdgeInsets.symmetric(vertical: 6), + iconPadding: EdgeInsets.zero, + minSize: 28, + tooltip: widget.presentationEmail.isSelected + ? AppLocalizations.of(context).selected + : AppLocalizations.of(context).notSelected, + onTap: () { + widget.emailActionClick?.call( + EmailActionType.selection, + widget.presentationEmail + ); }, ), - margin: const EdgeInsets.symmetric(vertical: 6), - iconPadding: EdgeInsets.zero, - minSize: 28, - tooltip: widget.presentationEmail.isSelected - ? AppLocalizations.of(context).selected - : AppLocalizations.of(context).notSelected, - onTap: () { - widget.emailActionClick?.call( - EmailActionType.selection, + buildIconWeb( + icon: SvgPicture.asset( + widget.presentationEmail.hasStarred + ? imagePaths.icStar + : imagePaths.icUnStar, + width: 20, + height: 20, + fit: BoxFit.fill + ), + margin: const EdgeInsets.symmetric(vertical: 6), + iconPadding: EdgeInsets.zero, + minSize: 28, + tooltip: widget.presentationEmail.hasStarred + ? AppLocalizations.of(context).starred + : AppLocalizations.of(context).not_starred, + onTap: () => widget.emailActionClick?.call( + widget.presentationEmail.hasStarred + ? EmailActionType.unMarkAsStarred + : EmailActionType.markAsStarred, widget.presentationEmail - ); - }, - ), - buildIconWeb( - icon: SvgPicture.asset( - widget.presentationEmail.hasStarred - ? imagePaths.icStar - : imagePaths.icUnStar, - width: 20, - height: 20, - fit: BoxFit.fill + ) ), - margin: const EdgeInsets.symmetric(vertical: 6), - iconPadding: EdgeInsets.zero, - minSize: 28, - tooltip: widget.presentationEmail.hasStarred - ? AppLocalizations.of(context).starred - : AppLocalizations.of(context).not_starred, - onTap: () => widget.emailActionClick?.call( - widget.presentationEmail.hasStarred - ? EmailActionType.unMarkAsStarred - : EmailActionType.markAsStarred, - widget.presentationEmail - ) - ), - buildIconWeb( - icon: buildIconAnsweredOrForwarded(presentationEmail: widget.presentationEmail), - tooltip: messageToolTipForAnsweredOrForwarded(context, widget.presentationEmail), - margin: const EdgeInsets.symmetric(vertical: 6), - iconPadding: EdgeInsets.zero, - minSize: 28, - splashRadius: 1 - ), - buildIconWeb( - icon: widget.presentationEmail.hasRead - ? const SizedBox(width: 20, height: 20) - : Container( - alignment: Alignment.center, - width: 20, - height: 20, - child: SvgPicture.asset( - imagePaths.icUnreadStatus, - width: 9, - height: 9, - fit: BoxFit.fill + buildIconWeb( + icon: buildIconAnsweredOrForwarded(presentationEmail: widget.presentationEmail), + tooltip: messageToolTipForAnsweredOrForwarded(context, widget.presentationEmail), + margin: const EdgeInsets.symmetric(vertical: 6), + iconPadding: EdgeInsets.zero, + minSize: 28, + splashRadius: 1 + ), + buildIconWeb( + icon: widget.presentationEmail.hasRead + ? const SizedBox(width: 20, height: 20) + : Container( + alignment: Alignment.center, + width: 20, + height: 20, + child: SvgPicture.asset( + imagePaths.icUnreadStatus, + width: 9, + height: 9, + fit: BoxFit.fill + ), ), - ), - margin: const EdgeInsets.symmetric(vertical: 6), - iconPadding: EdgeInsets.zero, - minSize: 28, - tooltip: widget.presentationEmail.hasRead - ? null - : AppLocalizations.of(context).mark_as_read, - onTap: widget.presentationEmail.hasRead ? null : () { - widget.emailActionClick?.call( - EmailActionType.markAsRead, - widget.presentationEmail - ); - }, - ), - buildIconAvatarText( - widget.presentationEmail, - iconSize: 32, - textStyle: const TextStyle( - fontSize: 12, - fontWeight: FontWeight.w600, - color: Colors.white + margin: const EdgeInsets.symmetric(vertical: 6), + iconPadding: EdgeInsets.zero, + minSize: 28, + tooltip: widget.presentationEmail.hasRead + ? null + : AppLocalizations.of(context).mark_as_read, + onTap: widget.presentationEmail.hasRead ? null : () { + widget.emailActionClick?.call( + EmailActionType.markAsRead, + widget.presentationEmail + ); + }, ), - ), - const SizedBox(width: 10), - SizedBox( - width: 160, - child: buildInformationSender( - context, + buildIconAvatarText( widget.presentationEmail, - widget.mailboxContain, - widget.isSearchEmailRunning, - widget.searchQuery - ) - ), - const SizedBox(width: 24), - Expanded(child: _buildSubjectAndContent()), - const SizedBox(width: 16), - ValueListenableBuilder( - valueListenable: _hoverNotifier, - builder: (context, value, child) { - if (value) { - return _buildListActionButtonWhenHover(context); - } else { - return _buildDateTimeForDesktopScreen(context); + iconSize: 32, + textStyle: const TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + color: Colors.white + ), + ), + const SizedBox(width: 10), + SizedBox( + width: 160, + child: buildInformationSender( + context, + widget.presentationEmail, + widget.mailboxContain, + widget.isSearchEmailRunning, + widget.searchQuery + ) + ), + const SizedBox(width: 24), + Expanded(child: _buildSubjectAndContent()), + const SizedBox(width: 16), + ValueListenableBuilder( + valueListenable: _hoverNotifier, + builder: (context, value, child) { + if (value) { + return _buildListActionButtonWhenHover(context); + } else { + return _buildDateTimeForDesktopScreen(context); + } } - } - ), - ]), + ), + ]), + ), ), ), ), @@ -615,11 +619,15 @@ class _EmailTileBuilderState extends State with BaseEmailItem Container( constraints: BoxConstraints(maxWidth: constraints.maxWidth / 2), padding: const EdgeInsetsDirectional.only(end: 12), - child: buildEmailTitle( - context, - widget.presentationEmail, - widget.isSearchEmailRunning, - widget.searchQuery + child: Semantics( + identifier: EmailTileKeyValues.subject, + container: true, + child: buildEmailTitle( + context, + widget.presentationEmail, + widget.isSearchEmailRunning, + widget.searchQuery + ), )), Expanded(child: Container( child: buildEmailPartialContent(