From 5c95fb997e15aa40c4d83af9ff37d1e03c619713 Mon Sep 17 00:00:00 2001 From: dab246 Date: Wed, 14 Aug 2024 14:58:27 +0700 Subject: [PATCH] Fix cannot click item in popup menu --- .../base/widget/popup_item_widget.dart | 67 ++++++++++--------- .../composer/presentation/composer_view.dart | 3 + .../presentation/composer_view_web.dart | 4 ++ .../email/presentation/email_view.dart | 1 + .../mixin/mailbox_widget_mixin.dart | 1 + .../mailbox_dashboard_view_web.dart | 2 + .../mixin/filter_email_popup_menu_mixin.dart | 3 + .../mixin/user_setting_popup_menu_mixin.dart | 2 + .../advanced_search_input_form.dart | 1 + .../email/presentation/search_email_view.dart | 3 + .../thread/presentation/thread_view.dart | 3 + 11 files changed, 58 insertions(+), 32 deletions(-) diff --git a/lib/features/base/widget/popup_item_widget.dart b/lib/features/base/widget/popup_item_widget.dart index 169f51205f..03a14ebea6 100644 --- a/lib/features/base/widget/popup_item_widget.dart +++ b/lib/features/base/widget/popup_item_widget.dart @@ -33,38 +33,41 @@ class PopupItemWidget extends StatelessWidget { @override Widget build(BuildContext context) { - return PointerInterceptor( - child: InkWell( - onTap: onCallbackAction, - child: Container( - height: PopupItemWidgetStyle.height, - constraints: const BoxConstraints(minWidth: PopupItemWidgetStyle.minWidth), - padding: padding, - child: Row(children: [ - SvgPicture.asset( - _iconAction, - width: iconSize ?? PopupItemWidgetStyle.iconSize, - height: iconSize ?? PopupItemWidgetStyle.iconSize, - fit: BoxFit.fill, - colorFilter: colorIcon?.asFilter() - ), - const SizedBox(width: PopupItemWidgetStyle.space), - Expanded(child: Text( - _nameAction, - style: styleName ?? PopupItemWidgetStyle.labelTextStyle - )), - if (isSelected == true && selectedIcon != null) - Padding( - padding: PopupItemWidgetStyle.iconSelectedPadding, - child: SvgPicture.asset( - selectedIcon!, - width: PopupItemWidgetStyle.selectedIconSize, - height: PopupItemWidgetStyle.selectedIconSize, - fit: BoxFit.fill - ), - ) - ]), - ) + return Semantics( + excludeSemantics: true, + child: PointerInterceptor( + child: InkWell( + onTap: onCallbackAction, + child: Container( + height: PopupItemWidgetStyle.height, + constraints: const BoxConstraints(minWidth: PopupItemWidgetStyle.minWidth), + padding: padding, + child: Row(children: [ + SvgPicture.asset( + _iconAction, + width: iconSize ?? PopupItemWidgetStyle.iconSize, + height: iconSize ?? PopupItemWidgetStyle.iconSize, + fit: BoxFit.fill, + colorFilter: colorIcon?.asFilter() + ), + const SizedBox(width: PopupItemWidgetStyle.space), + Expanded(child: Text( + _nameAction, + style: styleName ?? PopupItemWidgetStyle.labelTextStyle + )), + if (isSelected == true && selectedIcon != null) + Padding( + padding: PopupItemWidgetStyle.iconSelectedPadding, + child: SvgPicture.asset( + selectedIcon!, + width: PopupItemWidgetStyle.selectedIconSize, + height: PopupItemWidgetStyle.selectedIconSize, + fit: BoxFit.fill + ), + ) + ]), + ) + ), ), ); } diff --git a/lib/features/composer/presentation/composer_view.dart b/lib/features/composer/presentation/composer_view.dart index 47c42d6123..8954bd68fc 100644 --- a/lib/features/composer/presentation/composer_view.dart +++ b/lib/features/composer/presentation/composer_view.dart @@ -424,6 +424,7 @@ class ComposerView extends GetWidget { List _createMoreOptionPopupItems(BuildContext context) { return [ PopupMenuItem( + enabled: false, padding: EdgeInsets.zero, child: PopupItemWidget( controller.imagePaths.icReadReceipt, @@ -440,6 +441,7 @@ class ComposerView extends GetWidget { ) ), PopupMenuItem( + enabled: false, padding: EdgeInsets.zero, child: PopupItemWidget( controller.imagePaths.icSaveToDraft, @@ -454,6 +456,7 @@ class ComposerView extends GetWidget { ) ), PopupMenuItem( + enabled: false, padding: EdgeInsets.zero, child: PopupItemWidget( controller.imagePaths.icDeleteMailbox, diff --git a/lib/features/composer/presentation/composer_view_web.dart b/lib/features/composer/presentation/composer_view_web.dart index 943356f8cb..f0f987e62c 100644 --- a/lib/features/composer/presentation/composer_view_web.dart +++ b/lib/features/composer/presentation/composer_view_web.dart @@ -796,6 +796,7 @@ class ComposerView extends GetWidget { List _createMoreOptionPopupItems(BuildContext context) { return [ PopupMenuItem( + enabled: false, padding: EdgeInsets.zero, child: PopupItemWidget( controller.imagePaths.icStyleCodeView, @@ -812,6 +813,7 @@ class ComposerView extends GetWidget { ) ), PopupMenuItem( + enabled: false, padding: EdgeInsets.zero, child: PopupItemWidget( controller.imagePaths.icReadReceipt, @@ -828,6 +830,7 @@ class ComposerView extends GetWidget { ) ), PopupMenuItem( + enabled: false, padding: EdgeInsets.zero, child: PopupItemWidget( controller.imagePaths.icSaveToDraft, @@ -842,6 +845,7 @@ class ComposerView extends GetWidget { ) ), PopupMenuItem( + enabled: false, padding: EdgeInsets.zero, child: PopupItemWidget( controller.imagePaths.icDeleteMailbox, diff --git a/lib/features/email/presentation/email_view.dart b/lib/features/email/presentation/email_view.dart index 888f309ab0..28a169a7c5 100644 --- a/lib/features/email/presentation/email_view.dart +++ b/lib/features/email/presentation/email_view.dart @@ -558,6 +558,7 @@ class EmailView extends GetWidget { ) { return actionTypes.map((action) { return PopupMenuItem( + enabled: false, key: Key('${action.name}_action'), padding: EdgeInsets.zero, child: PopupItemWidget( diff --git a/lib/features/mailbox/presentation/mixin/mailbox_widget_mixin.dart b/lib/features/mailbox/presentation/mixin/mailbox_widget_mixin.dart index cd49df0eae..6e67920f4d 100644 --- a/lib/features/mailbox/presentation/mixin/mailbox_widget_mixin.dart +++ b/lib/features/mailbox/presentation/mixin/mailbox_widget_mixin.dart @@ -258,6 +258,7 @@ mixin MailboxWidgetMixin { } ) { return PopupMenuItem( + enabled: false, padding: EdgeInsets.zero, child: AbsorbPointer( absorbing: !contextMenuItem.isActivated, diff --git a/lib/features/mailbox_dashboard/presentation/mailbox_dashboard_view_web.dart b/lib/features/mailbox_dashboard/presentation/mailbox_dashboard_view_web.dart index e885dc12bc..da4555ca1a 100644 --- a/lib/features/mailbox_dashboard/presentation/mailbox_dashboard_view_web.dart +++ b/lib/features/mailbox_dashboard/presentation/mailbox_dashboard_view_web.dart @@ -589,6 +589,7 @@ class MailboxDashBoardView extends BaseMailboxDashBoardView { ) { return EmailReceiveTimeType.values .map((receiveTime) => PopupMenuItem( + enabled: false, padding: EdgeInsets.zero, child: PopupItemNoIconWidget( receiveTime.getTitle(context), @@ -607,6 +608,7 @@ class MailboxDashBoardView extends BaseMailboxDashBoardView { ) { return EmailSortOrderType.values .map((sortType) => PopupMenuItem( + enabled: false, padding: EdgeInsets.zero, child: PopupItemNoIconWidget( sortType.getTitle(context), diff --git a/lib/features/mailbox_dashboard/presentation/mixin/filter_email_popup_menu_mixin.dart b/lib/features/mailbox_dashboard/presentation/mixin/filter_email_popup_menu_mixin.dart index 056cbe43f9..e4cd4bb021 100644 --- a/lib/features/mailbox_dashboard/presentation/mixin/filter_email_popup_menu_mixin.dart +++ b/lib/features/mailbox_dashboard/presentation/mixin/filter_email_popup_menu_mixin.dart @@ -21,6 +21,7 @@ mixin FilterEmailPopupMenuMixin { if (!isSearchEmailRunning) ...[ PopupMenuItem( + enabled: false, padding: EdgeInsets.zero, child: _filterEmailAction( context, @@ -30,6 +31,7 @@ mixin FilterEmailPopupMenuMixin { const PopupMenuDivider(height: 0.5) ], PopupMenuItem( + enabled: false, padding: EdgeInsets.zero, child: _filterEmailAction( context, @@ -38,6 +40,7 @@ mixin FilterEmailPopupMenuMixin { onCallBack)), const PopupMenuDivider(height: 0.5), PopupMenuItem( + enabled: false, padding: EdgeInsets.zero, child: _filterEmailAction( context, diff --git a/lib/features/mailbox_dashboard/presentation/mixin/user_setting_popup_menu_mixin.dart b/lib/features/mailbox_dashboard/presentation/mixin/user_setting_popup_menu_mixin.dart index 08b5592cd6..ac65b0f189 100644 --- a/lib/features/mailbox_dashboard/presentation/mixin/user_setting_popup_menu_mixin.dart +++ b/lib/features/mailbox_dashboard/presentation/mixin/user_setting_popup_menu_mixin.dart @@ -43,6 +43,7 @@ mixin UserSettingPopupMenuMixin { ...[ const PopupMenuDivider(height: 0.5), PopupMenuItem( + enabled: false, padding: EdgeInsets.zero, child: _settingAction(context, onSettingAction) ), @@ -52,6 +53,7 @@ mixin UserSettingPopupMenuMixin { ...[ const PopupMenuDivider(height: 0.5), PopupMenuItem( + enabled: false, padding: EdgeInsets.zero, child: _logoutAction(context, onLogoutAction) ), diff --git a/lib/features/mailbox_dashboard/presentation/widgets/advanced_search/advanced_search_input_form.dart b/lib/features/mailbox_dashboard/presentation/widgets/advanced_search/advanced_search_input_form.dart index 540b9e06f7..fea3288dbe 100644 --- a/lib/features/mailbox_dashboard/presentation/widgets/advanced_search/advanced_search_input_form.dart +++ b/lib/features/mailbox_dashboard/presentation/widgets/advanced_search/advanced_search_input_form.dart @@ -120,6 +120,7 @@ class AdvancedSearchInputForm extends GetWidget List _buildEmailReceiveTimeTypeActionTiles(BuildContext context) { return EmailReceiveTimeType.values .map((receiveTime) => PopupMenuItem( + enabled: false, padding: EdgeInsets.zero, child: PopupItemNoIconWidget( receiveTime.getTitle(context), diff --git a/lib/features/search/email/presentation/search_email_view.dart b/lib/features/search/email/presentation/search_email_view.dart index cc73dca65a..b037943fe0 100644 --- a/lib/features/search/email/presentation/search_email_view.dart +++ b/lib/features/search/email/presentation/search_email_view.dart @@ -287,6 +287,7 @@ class SearchEmailView extends GetWidget ) { return EmailReceiveTimeType.values .map((timeType) => PopupMenuItem( + enabled: false, padding: EdgeInsets.zero, child: EmailReceiveTimeActionTileWidget( receiveTimeSelected: receiveTimeSelected, @@ -329,6 +330,7 @@ class SearchEmailView extends GetWidget ) { return EmailSortOrderType.values .map((sortType) => PopupMenuItem( + enabled: false, padding: EdgeInsets.zero, child: EmailSortByActionTitleWidget( sortType: sortType, @@ -639,6 +641,7 @@ class SearchEmailView extends GetWidget List _popupMenuActionTile(BuildContext context, PresentationEmail email) { return [ PopupMenuItem( + enabled: false, padding: const EdgeInsets.symmetric(horizontal: 8), child: _markAsEmailSpamOrUnSpamAction(context, email)), ]; diff --git a/lib/features/thread/presentation/thread_view.dart b/lib/features/thread/presentation/thread_view.dart index a9515f60e4..b6a172794b 100644 --- a/lib/features/thread/presentation/thread_view.dart +++ b/lib/features/thread/presentation/thread_view.dart @@ -804,6 +804,7 @@ class ThreadView extends GetWidget PresentationMailbox? mailboxContain ) { return PopupMenuItem( + enabled: false, padding: EdgeInsets.zero, child: popupItem( mailboxContain?.isSpam == true ? controller.imagePaths.icNotSpam : controller.imagePaths.icSpam, @@ -832,6 +833,7 @@ class ThreadView extends GetWidget PresentationMailbox? mailboxContain ) { return PopupMenuItem( + enabled: false, padding: EdgeInsets.zero, child: popupItem( controller.imagePaths.icOpenInNewTab, @@ -855,6 +857,7 @@ class ThreadView extends GetWidget PresentationEmail email ) { return PopupMenuItem( + enabled: false, padding: EdgeInsets.zero, child: popupItem( controller.imagePaths.icMailboxArchived,