Skip to content

Commit

Permalink
Fix cannot item in sortBy popup menu
Browse files Browse the repository at this point in the history
  • Loading branch information
dab246 committed Aug 15, 2024
1 parent 416a0f3 commit 9b4fe20
Show file tree
Hide file tree
Showing 2 changed files with 98 additions and 92 deletions.
61 changes: 32 additions & 29 deletions lib/features/base/widget/popup_item_no_icon_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,36 +28,39 @@ class PopupItemNoIconWidget extends StatelessWidget {

@override
Widget build(BuildContext context) {
return PointerInterceptor(
child: InkWell(
onTap: onCallbackAction,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 16),
child: SizedBox(
width: maxWidth,
child: Row(children: [
Expanded(child: Text(
_nameAction,
style: const TextStyle(
fontSize: 17,
color: Colors.black,
fontWeight: FontWeight.normal
)
)),
if (isSelected && svgIconSelected != null)
...[
const SizedBox(width: 12),
SvgPicture.asset(
svgIconSelected!,
width: 24,
height: 24,
fit: BoxFit.fill
),
]
]),
),
return Semantics(
excludeSemantics: true,
child: PointerInterceptor(
child: InkWell(
onTap: onCallbackAction,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 16),
child: SizedBox(
width: maxWidth,
child: Row(children: [
Expanded(child: Text(
_nameAction,
style: const TextStyle(
fontSize: 17,
color: Colors.black,
fontWeight: FontWeight.normal
)
)),
if (isSelected && svgIconSelected != null)
...[
const SizedBox(width: 12),
SvgPicture.asset(
svgIconSelected!,
width: 24,
height: 24,
fit: BoxFit.fill
),
]
]),
),
)
)
)
),
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -513,70 +513,73 @@ class MailboxDashBoardView extends BaseMailboxDashBoardView {
right: AppUtils.isDirectionRTL(context) ? 0 : 8,
left: AppUtils.isDirectionRTL(context) ? 8 : 0,
),
child: InkWell(
onTap: () {
if (!filter.isTapOpenPopupMenu()) {
controller.selectQuickSearchFilterAction(filter);
}
},
onTapDown: (detail) {
final screenSize = MediaQuery.of(context).size;
final offset = detail.globalPosition;
final position = RelativeRect.fromLTRB(
offset.dx,
offset.dy,
screenSize.width - offset.dx,
screenSize.height - offset.dy,
);
child: Semantics(
button: true,
child: InkWell(
onTap: filter.isTapOpenPopupMenu()
? null
: () => controller.selectQuickSearchFilterAction(filter),
onTapDown: !filter.isTapOpenPopupMenu()
? null
: (detail) {
final screenSize = MediaQuery.of(context).size;
final offset = detail.globalPosition;
final position = RelativeRect.fromLTRB(
offset.dx,
offset.dy,
screenSize.width - offset.dx,
screenSize.height - offset.dy,
);

switch(filter) {
case QuickSearchFilter.last7Days:
_openPopupMenuDateFilter(context, position);
break;
case QuickSearchFilter.sortBy:
_openPopupMenuSortFilter(context, position);
break;
default:
break;
}
},
borderRadius: const BorderRadius.all(Radius.circular(10)),
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: filter.getBackgroundColor(isFilterSelected: isFilterSelected)),
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
child: Row(mainAxisAlignment: MainAxisAlignment.center, children: [
SvgPicture.asset(
filter.getIcon(controller.imagePaths, isFilterSelected: isFilterSelected),
width: 16,
height: 16,
fit: BoxFit.fill),
const SizedBox(width: 4),
Text(
filter == QuickSearchFilter.fromMe
? _getQuickSearchFilterFromTitle(context)
: filter.getTitle(
context,
receiveTimeType: controller.searchController.receiveTimeFiltered,
startDate: controller.searchController.startDateFiltered,
endDate: controller.searchController.endDateFiltered,
sortOrderType: controller.searchController.sortOrderFiltered.value,
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: filter.getTextStyle(isFilterSelected: isFilterSelected),
),
if (filter == QuickSearchFilter.last7Days || filter == QuickSearchFilter.fromMe)
... [
const SizedBox(width: 4),
SvgPicture.asset(
controller.imagePaths.icChevronDown,
width: 16,
height: 16,
fit: BoxFit.fill),
]
])),
switch(filter) {
case QuickSearchFilter.last7Days:
_openPopupMenuDateFilter(context, position);
break;
case QuickSearchFilter.sortBy:
_openPopupMenuSortFilter(context, position);
break;
default:
break;
}
},
borderRadius: const BorderRadius.all(Radius.circular(10)),
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: filter.getBackgroundColor(isFilterSelected: isFilterSelected)),
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
child: Row(mainAxisAlignment: MainAxisAlignment.center, children: [
SvgPicture.asset(
filter.getIcon(controller.imagePaths, isFilterSelected: isFilterSelected),
width: 16,
height: 16,
fit: BoxFit.fill),
const SizedBox(width: 4),
Text(
filter == QuickSearchFilter.fromMe
? _getQuickSearchFilterFromTitle(context)
: filter.getTitle(
context,
receiveTimeType: controller.searchController.receiveTimeFiltered,
startDate: controller.searchController.startDateFiltered,
endDate: controller.searchController.endDateFiltered,
sortOrderType: controller.searchController.sortOrderFiltered.value,
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: filter.getTextStyle(isFilterSelected: isFilterSelected),
),
if (filter == QuickSearchFilter.last7Days || filter == QuickSearchFilter.fromMe)
... [
const SizedBox(width: 4),
SvgPicture.asset(
controller.imagePaths.icChevronDown,
width: 16,
height: 16,
fit: BoxFit.fill),
]
])),
),
),
);
});
Expand Down

0 comments on commit 9b4fe20

Please sign in to comment.