From c34f1b42383805392679eeadd9012bfcd04979ba Mon Sep 17 00:00:00 2001 From: dab246 Date: Wed, 14 Aug 2024 19:21:06 +0700 Subject: [PATCH] Fix cannot click item dropdown menu --- .../base/widget/drop_down_button_widget.dart | 43 ++++---- .../drop_down_menu_header_style_widget.dart | 15 ++- .../web/from_composer_drop_down_widget.dart | 103 +++++++++--------- .../web/item_menu_font_size_widget.dart | 39 ++++--- .../date_selection_dropdown_button.dart | 49 +++++---- .../date_drop_down_button.dart | 51 +++++---- .../sort_by_drop_down_button.dart | 51 +++++---- 7 files changed, 186 insertions(+), 165 deletions(-) diff --git a/lib/features/base/widget/drop_down_button_widget.dart b/lib/features/base/widget/drop_down_button_widget.dart index 57e9811c90..0492af8499 100644 --- a/lib/features/base/widget/drop_down_button_widget.dart +++ b/lib/features/base/widget/drop_down_button_widget.dart @@ -78,26 +78,29 @@ class DropDownButtonWidget extends StatelessWidget { items: items .map((item) => DropdownMenuItem( value: item, - child: PointerInterceptor( - child: Container( - color: Colors.transparent, - height: heightItem, - child: Row(children: [ - Expanded(child: Text(_getTextItemDropdown(context, item: item), - style: const TextStyle( - fontSize: 16, - fontWeight: FontWeight.normal, - color: Colors.black), - maxLines: 1, - softWrap: CommonTextStyle.defaultSoftWrap, - overflow: CommonTextStyle.defaultTextOverFlow, - )), - if (supportSelectionIcon && item == itemSelected) - SvgPicture.asset(imagePaths.icChecked, - width: sizeIconChecked, - height: sizeIconChecked, - fit: BoxFit.fill) - ]), + child: Semantics( + excludeSemantics: true, + child: PointerInterceptor( + child: Container( + color: Colors.transparent, + height: heightItem, + child: Row(children: [ + Expanded(child: Text(_getTextItemDropdown(context, item: item), + style: const TextStyle( + fontSize: 16, + fontWeight: FontWeight.normal, + color: Colors.black), + maxLines: 1, + softWrap: CommonTextStyle.defaultSoftWrap, + overflow: CommonTextStyle.defaultTextOverFlow, + )), + if (supportSelectionIcon && item == itemSelected) + SvgPicture.asset(imagePaths.icChecked, + width: sizeIconChecked, + height: sizeIconChecked, + fit: BoxFit.fill) + ]), + ), ), ), )) diff --git a/lib/features/composer/presentation/widgets/drop_down_menu_header_style_widget.dart b/lib/features/composer/presentation/widgets/drop_down_menu_header_style_widget.dart index 357dd4a811..c989590776 100644 --- a/lib/features/composer/presentation/widgets/drop_down_menu_header_style_widget.dart +++ b/lib/features/composer/presentation/widgets/drop_down_menu_header_style_widget.dart @@ -34,12 +34,15 @@ class DropDownMenuHeaderStyleWidget extends StatelessWidget { items: items .map((item) => DropdownMenuItem( value: item, - child: PointerInterceptor( - child: Container( - color: Colors.transparent, - height: heightItem, - alignment: Alignment.centerLeft, - child: _buildItemDropdown(item), + child: Semantics( + excludeSemantics: true, + child: PointerInterceptor( + child: Container( + color: Colors.transparent, + height: heightItem, + alignment: Alignment.centerLeft, + child: _buildItemDropdown(item), + ), ), ), )) diff --git a/lib/features/composer/presentation/widgets/web/from_composer_drop_down_widget.dart b/lib/features/composer/presentation/widgets/web/from_composer_drop_down_widget.dart index 4dbec500b4..29c3dc35dd 100644 --- a/lib/features/composer/presentation/widgets/web/from_composer_drop_down_widget.dart +++ b/lib/features/composer/presentation/widgets/web/from_composer_drop_down_widget.dart @@ -68,57 +68,60 @@ class FromComposerDropDownWidget extends StatelessWidget { isExpanded: false, items: items.map((item) => DropdownMenuItem( value: item, - child: PointerInterceptor( - child: Container( - color: Colors.transparent, - padding: FromComposerDropDownWidgetStyle.dropdownItemPadding, - child: Row( - children: [ - Container( - width: FromComposerDropDownWidgetStyle.avatarSize, - height: FromComposerDropDownWidgetStyle.avatarSize, - alignment: Alignment.center, - decoration: BoxDecoration( - shape: BoxShape.circle, - color: AppColor.avatarColor, - border: Border.all( - color: AppColor.colorShadowBgContentEmail, - width: FromComposerDropDownWidgetStyle.avatarBorderWidth - ) - ), - child: Text( - item.name!.isNotEmpty - ? item.name!.firstLetterToUpperCase - : item.email!.firstLetterToUpperCase, - style: FromComposerDropDownWidgetStyle.avatarTextStyle, - ), - ), - const SizedBox(width: FromComposerDropDownWidgetStyle.dropdownItemSpace), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - if (item.name!.isNotEmpty) - Text( - item.name!, - maxLines: 1, - softWrap: CommonTextStyle.defaultSoftWrap, - overflow: CommonTextStyle.defaultTextOverFlow, - style: FromComposerDropDownWidgetStyle.dropdownItemTitleTextStyle, - ), - if (item.email!.isNotEmpty) - Text( - item.email!, - maxLines: 1, - softWrap: CommonTextStyle.defaultSoftWrap, - overflow: CommonTextStyle.defaultTextOverFlow, - style: FromComposerDropDownWidgetStyle.dropdownItemSubTitleTextStyle, - ) - ], + child: Semantics( + excludeSemantics: true, + child: PointerInterceptor( + child: Container( + color: Colors.transparent, + padding: FromComposerDropDownWidgetStyle.dropdownItemPadding, + child: Row( + children: [ + Container( + width: FromComposerDropDownWidgetStyle.avatarSize, + height: FromComposerDropDownWidgetStyle.avatarSize, + alignment: Alignment.center, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: AppColor.avatarColor, + border: Border.all( + color: AppColor.colorShadowBgContentEmail, + width: FromComposerDropDownWidgetStyle.avatarBorderWidth + ) + ), + child: Text( + item.name!.isNotEmpty + ? item.name!.firstLetterToUpperCase + : item.email!.firstLetterToUpperCase, + style: FromComposerDropDownWidgetStyle.avatarTextStyle, + ), ), - ) - ], + const SizedBox(width: FromComposerDropDownWidgetStyle.dropdownItemSpace), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + if (item.name!.isNotEmpty) + Text( + item.name!, + maxLines: 1, + softWrap: CommonTextStyle.defaultSoftWrap, + overflow: CommonTextStyle.defaultTextOverFlow, + style: FromComposerDropDownWidgetStyle.dropdownItemTitleTextStyle, + ), + if (item.email!.isNotEmpty) + Text( + item.email!, + maxLines: 1, + softWrap: CommonTextStyle.defaultSoftWrap, + overflow: CommonTextStyle.defaultTextOverFlow, + style: FromComposerDropDownWidgetStyle.dropdownItemSubTitleTextStyle, + ) + ], + ), + ) + ], + ), ), ), ), diff --git a/lib/features/composer/presentation/widgets/web/item_menu_font_size_widget.dart b/lib/features/composer/presentation/widgets/web/item_menu_font_size_widget.dart index 576bea5e8d..3effc35f9a 100644 --- a/lib/features/composer/presentation/widgets/web/item_menu_font_size_widget.dart +++ b/lib/features/composer/presentation/widgets/web/item_menu_font_size_widget.dart @@ -21,26 +21,29 @@ class ItemMenuFontSizeWidget extends StatelessWidget { @override Widget build(BuildContext context) { - return PointerInterceptor( - child: Container( - alignment: Alignment.center, - color: Colors.transparent, - child: Stack( + return Semantics( + excludeSemantics: true, + child: PointerInterceptor( + child: Container( alignment: Alignment.center, - children: [ - Text( - '$value', - style: ItemMenuFontSizeWidgetStyle.labelTextStyle, - ), - if (value == selectedValue) - Align( - alignment: AlignmentDirectional.centerStart, - child: Padding( - padding: ItemMenuFontSizeWidgetStyle.selectIconPadding, - child: SvgPicture.asset(_imagePaths.icSelectedSB), + color: Colors.transparent, + child: Stack( + alignment: Alignment.center, + children: [ + Text( + '$value', + style: ItemMenuFontSizeWidgetStyle.labelTextStyle, + ), + if (value == selectedValue) + Align( + alignment: AlignmentDirectional.centerStart, + child: Padding( + padding: ItemMenuFontSizeWidgetStyle.selectIconPadding, + child: SvgPicture.asset(_imagePaths.icSelectedSB), + ) ) - ) - ], + ], + ), ), ), ); diff --git a/lib/features/email_recovery/presentation/widgets/date_selection_field/date_selection_dropdown_button.dart b/lib/features/email_recovery/presentation/widgets/date_selection_field/date_selection_dropdown_button.dart index 32cc96f31d..7fc9cc36c1 100644 --- a/lib/features/email_recovery/presentation/widgets/date_selection_field/date_selection_dropdown_button.dart +++ b/lib/features/email_recovery/presentation/widgets/date_selection_field/date_selection_dropdown_button.dart @@ -108,29 +108,32 @@ class DateSelectionDropDownButton extends StatelessWidget { ) { return DropdownMenuItem( value: recoveryTime, - child: PointerInterceptor( - child: Container( - color: Colors.transparent, - height: DateSelectionDropdownButtonStyles.height, - child: Row( - children: [ - Expanded( - child: Text( - recoveryTime.getTitle(context), - style: DateSelectionDropdownButtonStyles.selectedValueTexStyle, - maxLines: 1, - softWrap: CommonTextStyle.defaultSoftWrap, - overflow: CommonTextStyle.defaultTextOverFlow, - ) - ), - if (recoveryTime == recoveryTimeSelected) - SvgPicture.asset( - imagePaths.icChecked, - width: DateSelectionDropdownButtonStyles.checkedIconSize, - height: DateSelectionDropdownButtonStyles.checkedIconSize, - fit: BoxFit.fill - ) - ] + child: Semantics( + excludeSemantics: true, + child: PointerInterceptor( + child: Container( + color: Colors.transparent, + height: DateSelectionDropdownButtonStyles.height, + child: Row( + children: [ + Expanded( + child: Text( + recoveryTime.getTitle(context), + style: DateSelectionDropdownButtonStyles.selectedValueTexStyle, + maxLines: 1, + softWrap: CommonTextStyle.defaultSoftWrap, + overflow: CommonTextStyle.defaultTextOverFlow, + ) + ), + if (recoveryTime == recoveryTimeSelected) + SvgPicture.asset( + imagePaths.icChecked, + width: DateSelectionDropdownButtonStyles.checkedIconSize, + height: DateSelectionDropdownButtonStyles.checkedIconSize, + fit: BoxFit.fill + ) + ] + ), ), ), ), diff --git a/lib/features/mailbox_dashboard/presentation/widgets/advanced_search/date_drop_down_button.dart b/lib/features/mailbox_dashboard/presentation/widgets/advanced_search/date_drop_down_button.dart index e786dde2be..92eae0a4cb 100644 --- a/lib/features/mailbox_dashboard/presentation/widgets/advanced_search/date_drop_down_button.dart +++ b/lib/features/mailbox_dashboard/presentation/widgets/advanced_search/date_drop_down_button.dart @@ -106,30 +106,33 @@ class DateDropDownButton extends StatelessWidget { ) { return DropdownMenuItem( value: receiveTime, - child: PointerInterceptor( - child: Container( - color: Colors.transparent, - height: 44, - child: Row(children: [ - Expanded(child: Text( - receiveTime.getTitle(context), - style: const TextStyle( - fontSize: 16, - fontWeight: FontWeight.normal, - color: Colors.black - ), - maxLines: 1, - softWrap: CommonTextStyle.defaultSoftWrap, - overflow: CommonTextStyle.defaultTextOverFlow, - )), - if (receiveTime == receiveTimeSelected) - SvgPicture.asset( - imagePaths.icChecked, - width: 20, - height: 20, - fit: BoxFit.fill - ) - ]), + child: Semantics( + excludeSemantics: true, + child: PointerInterceptor( + child: Container( + color: Colors.transparent, + height: 44, + child: Row(children: [ + Expanded(child: Text( + receiveTime.getTitle(context), + style: const TextStyle( + fontSize: 16, + fontWeight: FontWeight.normal, + color: Colors.black + ), + maxLines: 1, + softWrap: CommonTextStyle.defaultSoftWrap, + overflow: CommonTextStyle.defaultTextOverFlow, + )), + if (receiveTime == receiveTimeSelected) + SvgPicture.asset( + imagePaths.icChecked, + width: 20, + height: 20, + fit: BoxFit.fill + ) + ]), + ), ), ), ); diff --git a/lib/features/mailbox_dashboard/presentation/widgets/advanced_search/sort_by_drop_down_button.dart b/lib/features/mailbox_dashboard/presentation/widgets/advanced_search/sort_by_drop_down_button.dart index ef591f99f6..3f81aa441c 100644 --- a/lib/features/mailbox_dashboard/presentation/widgets/advanced_search/sort_by_drop_down_button.dart +++ b/lib/features/mailbox_dashboard/presentation/widgets/advanced_search/sort_by_drop_down_button.dart @@ -32,31 +32,34 @@ class SortByDropDownButton extends StatelessWidget { items: EmailSortOrderType.values .map((sortType) => DropdownMenuItem( value: sortType, - child: PointerInterceptor( - child: Container( - color: Colors.transparent, - height: SortByDropdownStyle.height, - child: Row( - children: [ - Expanded( - child: Text( - sortType.getTitle(context), - style: sortType.getTextStyle(isInDropdown: true), - maxLines: 1, - softWrap: CommonTextStyle.defaultSoftWrap, - overflow: CommonTextStyle.defaultTextOverFlow, + child: Semantics( + excludeSemantics: true, + child: PointerInterceptor( + child: Container( + color: Colors.transparent, + height: SortByDropdownStyle.height, + child: Row( + children: [ + Expanded( + child: Text( + sortType.getTitle(context), + style: sortType.getTextStyle(isInDropdown: true), + maxLines: 1, + softWrap: CommonTextStyle.defaultSoftWrap, + overflow: CommonTextStyle.defaultTextOverFlow, + ), ), - ), - if (sortType == sortOrderSelected) - SvgPicture.asset( - imagePaths.icChecked, - width: SortByDropdownStyle.checkedIconSize, - height: SortByDropdownStyle.checkedIconSize, - fit: BoxFit.fill, - ) - ], - ), - ) + if (sortType == sortOrderSelected) + SvgPicture.asset( + imagePaths.icChecked, + width: SortByDropdownStyle.checkedIconSize, + height: SortByDropdownStyle.checkedIconSize, + fit: BoxFit.fill, + ) + ], + ), + ) + ), ) )).toList(), value: sortOrderSelected,