TF-1427 Apply new design for search mailbox on mobile/tablet

This commit is contained in:
dab246
2023-02-09 16:43:37 +07:00
committed by Dat Vu
parent 705dd5d28c
commit 2cc2e17bf2
16 changed files with 153 additions and 47 deletions
+11
View File
@@ -0,0 +1,11 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd"
d="M9.38099 8.14411C8.90833 8.17037 8.54646 8.57482 8.57271 9.04748L9.00129 16.7618C9.02754 17.2344 9.432 17.5963 9.90466 17.57C10.3773 17.5438 10.7392 17.1393 10.7129 16.6667L10.2844 8.95238C10.2581 8.47973 9.85365 8.11785 9.38099 8.14411Z"
fill="#E64646" />
<path fill-rule="evenodd" clip-rule="evenodd"
d="M14.6189 8.14411C15.0916 8.17037 15.4535 8.57482 15.4272 9.04748L14.9986 16.7618C14.9724 17.2344 14.5679 17.5963 14.0953 17.57C13.6226 17.5438 13.2607 17.1393 13.287 16.6667L13.7156 8.95238C13.7418 8.47973 14.1463 8.11785 14.6189 8.14411Z"
fill="#E64646" />
<path fill-rule="evenodd" clip-rule="evenodd"
d="M2.99997 4.28564C2.52658 4.28564 2.14282 4.6694 2.14282 5.14279C2.14282 5.61617 2.52658 5.99993 2.99997 5.99993H3.93947L5.05163 16.9907C5.11491 17.6162 5.16735 18.1345 5.24356 18.5562C5.32301 18.9957 5.43854 19.3962 5.66235 19.7681C6.01141 20.348 6.52431 20.8116 7.13641 21.1005C7.52889 21.2857 7.93899 21.3604 8.38432 21.3951C8.81154 21.4285 9.33248 21.4285 9.96115 21.4285H14.0388C14.6675 21.4285 15.1884 21.4285 15.6156 21.3951C16.0609 21.3604 16.471 21.2857 16.8635 21.1005C17.4756 20.8116 17.9885 20.348 18.3376 19.7681C18.5614 19.3962 18.6769 18.9957 18.7564 18.5562C18.8326 18.1345 18.885 17.6162 18.9483 16.9908L20.0605 5.99993H21C21.4734 5.99993 21.8571 5.61617 21.8571 5.14279C21.8571 4.6694 21.4734 4.28564 21 4.28564H15.7615C15.3718 2.56794 13.8356 1.28564 12 1.28564C10.1643 1.28564 8.62817 2.56794 8.2384 4.28564H2.99997ZM6.75385 16.785C6.82134 17.452 6.86762 17.9033 6.93052 18.2513C6.99152 18.5888 7.05768 18.762 7.13109 18.884C7.30562 19.174 7.56207 19.4058 7.86812 19.5502C7.99686 19.611 8.17586 19.6594 8.51783 19.6861C8.87037 19.7136 9.32407 19.7142 9.99445 19.7142H14.0055C14.6759 19.7142 15.1296 19.7136 15.4821 19.6861C15.8241 19.6594 16.0031 19.611 16.1318 19.5502C16.4379 19.4058 16.6943 19.174 16.8688 18.884C16.9423 18.762 17.0084 18.5888 17.0694 18.2513C17.1323 17.9033 17.1786 17.452 17.2461 16.785L18.3374 5.99993H5.66251L6.75385 16.785ZM12 2.99993C11.1213 2.99993 10.3661 3.52883 10.0354 4.28564H13.9645C13.6339 3.52883 12.8787 2.99993 12 2.99993Z"
fill="#E64646" />
</svg>

After

Width:  |  Height:  |  Size: 2.3 KiB

+5
View File
@@ -0,0 +1,5 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path
d="M6.60606 4.10798L11.1703 8.67227L11.1732 8.67155L15.3282 12.8265L15.3275 12.8294L20.3203 17.8223C20.6551 18.157 20.6551 18.6997 20.3203 19.0345C19.9856 19.3692 19.4429 19.3692 19.1082 19.0345L17.5008 17.4285C15.8405 18.3422 13.9548 18.8569 12 18.8569C7.0129 18.8569 2.14282 15.1232 2.14282 11.9998C2.14282 10.1766 4.01586 7.91178 6.5941 6.52047L5.39387 5.32017C5.05914 4.98543 5.05914 4.44272 5.39387 4.10798C5.72861 3.77325 6.27132 3.77325 6.60606 4.10798ZM3.85711 11.9998C3.85711 14.0621 7.87523 17.1426 12 17.1426C13.485 17.1426 14.9274 16.7908 16.2291 16.1573L14.4608 14.3871C13.8377 15.0293 12.9654 15.4284 12 15.4284C10.1064 15.4284 8.57139 13.8933 8.57139 11.9998C8.57139 11.0343 8.97046 10.162 9.61264 9.53894L7.86843 7.79612C5.55454 8.89439 3.85711 10.8289 3.85711 11.9998ZM12 5.14265C16.987 5.14265 21.8571 8.87638 21.8571 11.9998C21.8571 12.8095 21.4858 13.7126 20.8314 14.5998C20.5504 14.9808 20.0138 15.0619 19.6328 14.7809C19.2519 14.4999 19.1708 13.9633 19.4518 13.5823C19.9073 12.9646 20.1428 12.3918 20.1428 11.9998C20.1428 9.93749 16.1247 6.85693 12 6.85693C11.5266 6.85693 11.1428 6.47318 11.1428 5.99979C11.1428 5.5264 11.5266 5.14265 12 5.14265ZM10.8251 10.7514C10.493 11.064 10.2857 11.5077 10.2857 11.9998C10.2857 12.9466 11.0532 13.7141 12 13.7141C12.4921 13.7141 12.9357 13.5067 13.2484 13.1747L10.8251 10.7514Z"
fill="#007AFF" />
</svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

+5
View File
@@ -0,0 +1,5 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path
d="M5.31466 21.4284H18.6851C20.1981 21.4284 21.4284 20.2078 21.4284 18.7075V10.5192C21.4284 9.78092 21.1219 9.06814 20.5884 8.56329C20.5434 8.54053 13.7002 3.15889 13.7002 3.15889C12.6992 2.37483 11.3006 2.37602 10.2995 3.15889L3.52269 8.46527C2.9453 8.99196 2.56537 9.72132 2.57136 10.5192V18.7075C2.57136 20.2078 3.80169 21.4284 5.31466 21.4284ZM11.4395 4.59147C11.7688 4.33251 12.231 4.33251 12.5603 4.59147L18.4229 9.18101L12.5603 13.7705C12.231 14.0295 11.7688 14.0295 11.4395 13.7705L5.57689 9.18101L11.4395 4.59147ZM4.41059 10.5925L10.2995 15.2031C11.3005 15.9868 12.6992 15.986 13.7002 15.2031L19.5892 10.5925V18.7075C19.5892 19.2017 19.1839 19.6038 18.6851 19.6038H5.31466C4.8159 19.6038 4.41059 19.2017 4.41059 18.7075V10.5925Z"
fill="#007AFF" />
</svg>

After

Width:  |  Height:  |  Size: 886 B

+8
View File
@@ -0,0 +1,8 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd"
d="M9.10005 3.59201C8.92714 3.55051 8.75145 3.55098 8.6119 3.55134L8.57441 3.55141H7.04592C6.45517 3.55141 5.96755 3.55141 5.57016 3.58387C5.15717 3.61762 4.77762 3.69004 4.42104 3.87171C3.86804 4.15348 3.41846 4.60304 3.13676 5.15602C2.95506 5.51258 2.88259 5.89221 2.84887 6.30516C2.81641 6.70278 2.81641 7.19089 2.81641 7.78226V14.0144C2.81641 14.6058 2.81641 15.0939 2.84887 15.4915C2.88259 15.9045 2.95506 16.2841 3.13676 16.6407C3.41846 17.1937 3.86804 17.6432 4.42104 17.925C4.77762 18.1067 5.15717 18.1791 5.57016 18.2128C5.96773 18.2453 6.45589 18.2453 7.04726 18.2453H10.898C11.3038 18.2453 11.6327 17.9164 11.6327 17.5106C11.6327 17.1048 11.3038 16.7759 10.898 16.7759H7.07767C6.44835 16.7759 6.02047 16.7753 5.6898 16.7483C5.36775 16.722 5.203 16.6743 5.08811 16.6157C4.81161 16.4749 4.58686 16.2501 4.44597 15.9736C4.38741 15.8587 4.33969 15.694 4.31342 15.3719C4.28633 15.0412 4.28579 14.6134 4.28579 13.9841V10.1637L18.9797 10.1638C18.9797 10.5694 19.3085 10.8982 19.7141 10.8982C20.1199 10.8982 20.4489 10.5695 20.4474 10.1637C20.4466 9.96009 20.4456 9.73749 20.4439 9.51606C20.4474 9.4875 20.4491 9.45844 20.4491 9.42896C20.4491 9.39544 20.4467 9.36243 20.4424 9.3301C20.4378 8.79771 20.43 8.30548 20.4166 8.1419C20.3829 7.72895 20.3104 7.34931 20.1287 6.99275C19.847 6.43978 19.3974 5.99021 18.8444 5.70845C18.4878 5.52677 18.1083 5.45435 17.6953 5.42061C17.2979 5.38814 16.8103 5.38814 16.2195 5.38814H11.3849C11.2887 5.38814 11.2406 5.38796 11.2057 5.38637L11.2031 5.38626L11.2012 5.38449C11.1754 5.36094 11.1413 5.32709 11.0733 5.25904L9.92514 4.1109L9.89869 4.08433L9.89788 4.08359C9.7995 3.98478 9.676 3.86059 9.5247 3.76795C9.39323 3.68737 9.24991 3.628 9.10005 3.59201ZM18.973 8.69426C18.969 8.53153 18.9625 8.38929 18.9521 8.26156C18.9258 7.93946 18.8781 7.77473 18.8195 7.65984C18.6786 7.38335 18.4539 7.15855 18.1774 7.01768C18.0625 6.95914 17.8977 6.91143 17.5757 6.88513C17.245 6.85811 16.8172 6.85753 16.1878 6.85753H11.3849L11.3474 6.8576C11.2079 6.85798 11.0322 6.85845 10.8593 6.81695C10.7094 6.78094 10.5661 6.72157 10.4346 6.64101C10.283 6.5481 10.1591 6.42355 10.0607 6.3246L8.88606 5.14992C8.85297 5.11673 8.82786 5.09169 8.80786 5.072C8.78678 5.05131 8.77136 5.03653 8.75817 5.02447L8.7562 5.0227L8.7536 5.02257C8.71871 5.02097 8.67064 5.02079 8.57441 5.02079H7.07767C6.44835 5.02079 6.02047 5.02138 5.6898 5.04839C5.36775 5.07469 5.203 5.12241 5.08811 5.18095C4.81161 5.32182 4.58686 5.54661 4.44597 5.82311C4.38741 5.938 4.33969 6.10272 4.31342 6.42482C4.28633 6.75551 4.28579 7.18331 4.28579 7.81264V8.69426H18.973Z"
fill="#007AFF" />
<path fill-rule="evenodd" clip-rule="evenodd"
d="M21.1838 16.0411C21.1838 13.6065 19.2102 11.6329 16.7756 11.6329C14.341 11.6329 12.3674 13.6065 12.3674 16.0411C12.3674 18.4756 14.341 20.4492 16.7756 20.4492C19.2102 20.4492 21.1838 18.4756 21.1838 16.0411ZM16.1991 13.286C16.4837 13.0015 16.945 13.0015 17.2295 13.286L19.4696 15.5261C19.6198 15.6596 19.7143 15.8542 19.7143 16.0708C19.7143 16.2877 19.6196 16.4824 19.4693 16.6158L17.2295 18.8556C16.945 19.1401 16.4837 19.1401 16.1991 18.8556C15.9146 18.5711 15.9146 18.1098 16.1991 17.8252L17.225 16.7994H14.4429C14.0405 16.7994 13.7143 16.4732 13.7143 16.0708C13.7143 15.6684 14.0405 15.3422 14.4429 15.3422H17.225L16.1991 14.3163C15.9146 14.0318 15.9146 13.5705 16.1991 13.286Z"
fill="#007AFF" />
</svg>

After

Width:  |  Height:  |  Size: 3.4 KiB

+4 -3
View File
@@ -1,4 +1,5 @@
<svg width="21" height="20" viewBox="0 0 21 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M17.2896 2.15478C16.6379 1.5031 15.5814 1.5031 14.9297 2.15478L13.7497 3.33475L17.2896 6.87467L18.4696 5.6947C19.1213 5.04302 19.1213 3.98643 18.4696 3.33475L17.2896 2.15478Z" fill="#007AFF"/>
<path d="M15.6554 8.50893L12.1154 4.96901L4.8858 12.1986C4.15306 12.9314 3.60098 13.8247 3.27329 14.8077L2.31824 17.6729C2.18779 18.0642 2.56012 18.4366 2.95148 18.3061L5.81663 17.3511C6.7997 17.0234 7.69298 16.4713 8.42572 15.7386L15.6554 8.50893Z" fill="#007AFF"/>
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd"
d="M18.67 2.85888C17.9366 2.48519 17.0686 2.48519 16.3352 2.85888C15.9685 3.04574 15.6496 3.3654 15.2807 3.73523L4.00853 15.0075C3.705 15.3109 3.48695 15.5289 3.3078 15.7754C2.95002 16.2679 2.71386 16.838 2.61864 17.4392C2.57097 17.7402 2.57104 18.0485 2.57114 18.4777L2.57115 19.3714L2.57098 19.4408C2.5701 19.6823 2.56902 19.9792 2.65506 20.244C2.82463 20.7659 3.2338 21.1751 3.7557 21.3446C4.02049 21.4307 4.31737 21.4296 4.55889 21.4287L4.6283 21.4285L5.52202 21.4286C5.95115 21.4287 6.25945 21.4287 6.56048 21.3811C7.16168 21.2858 7.73181 21.0497 8.22426 20.6919C8.47083 20.5128 8.68877 20.2947 8.99214 19.9912L20.2645 8.71898C20.6343 8.35009 20.954 8.03123 21.1408 7.66451C21.5145 6.9311 21.5145 6.06312 21.1408 5.32971C20.954 4.96299 20.6343 4.64415 20.2645 4.27526L19.7245 3.73524C19.3556 3.3654 19.0367 3.04574 18.67 2.85888ZM17.1135 4.38632C17.3579 4.26176 17.6472 4.26176 17.8917 4.38632C17.9822 4.43242 18.0951 4.53041 18.5936 5.02882L18.9709 5.40615C19.4693 5.90456 19.5673 6.0175 19.6134 6.10797C19.7379 6.35244 19.7379 6.64177 19.6134 6.88624C19.5673 6.97671 19.4693 7.08966 18.9709 7.58807L18.2354 8.32352L15.6762 5.76427L16.4116 5.02883C16.91 4.53041 17.023 4.43242 17.1135 4.38632ZM14.464 6.97645L5.26454 16.1759C4.89986 16.5406 4.78459 16.6593 4.69469 16.7831C4.49592 17.0566 4.36472 17.3734 4.31182 17.7074C4.2879 17.8585 4.28544 18.0239 4.28544 18.5397V19.3714C4.28544 19.5403 4.28574 19.6326 4.28941 19.6997L4.29 19.7097L4.29999 19.7103C4.36708 19.714 4.45942 19.7143 4.6283 19.7143H5.46003C5.97576 19.7143 6.14123 19.7118 6.2923 19.6879C6.6263 19.635 6.94304 19.5038 7.21663 19.305C7.34037 19.2151 7.45911 19.0998 7.82379 18.7352L17.0232 9.5357L14.464 6.97645Z"
fill="#007AFF" />
</svg>

Before

Width:  |  Height:  |  Size: 572 B

After

Width:  |  Height:  |  Size: 1.8 KiB

@@ -169,6 +169,10 @@ class ImagePaths {
String get icSpamReportEnable => _getImagePath('ic_spam_report_enable.svg');
String get icClearSearchInput => _getImagePath('ic_clear_search_input.svg');
String get icHideFolder => _getImagePath('ic_hide_folder.svg');
String get icMoveMailbox => _getImagePath('ic_move_mailbox.svg');
String get icMarkAsRead => _getImagePath('ic_mark_as_read.svg');
String get icDeleteMailbox => _getImagePath('ic_delete_mailbox.svg');
String get icHideMailbox => _getImagePath('ic_hide_mailbox.svg');
String _getImagePath(String imageName) {
return AssetsPaths.images + imageName;
@@ -596,10 +596,10 @@ class MailboxController extends BaseMailboxController with MailboxActionHandlerM
bool isSearchActive() => searchState.value.searchStatus == SearchStatus.ACTIVE;
void enableSearch() {
_cancelSelectMailbox();
void openSearchViewAction(BuildContext context) {
SearchMailboxBindings().dependencies();
mailboxDashBoardController.searchMailboxActivated.value = true;
closeMailboxScreen(context);
}
void disableSearch() {
@@ -233,8 +233,8 @@ class MailboxView extends GetWidget<MailboxController> {
color: AppColor.colorTextButton,
fit: BoxFit.fill
),
tooltip: AppLocalizations.of(context).search_folder,
onTap: controller.enableSearch
tooltip: AppLocalizations.of(context).search_folder,
onTap: () => controller.openSearchViewAction(context)
),
buildIconWeb(
minSize: 40,
@@ -160,7 +160,7 @@ class MailboxView extends GetWidget<MailboxController> with AppLoaderMixin, Popu
color: AppColor.colorTextButton,
fit: BoxFit.fill
),
onTap: controller.enableSearch
onTap: () => controller.openSearchViewAction(context)
),
buildIconWeb(
minSize: 40,
@@ -463,14 +463,21 @@ class MailboxView extends GetWidget<MailboxController> with AppLoaderMixin, Popu
return (MailboxBottomSheetActionTileBuilder(
Key('${contextMenuItem.action.name}_action'),
SvgPicture.asset(
contextMenuItem.action.getContextMenuIcon(_imagePaths),
color: contextMenuItem.action.getColorContextMenuIcon()),
contextMenuItem.action.getContextMenuIcon(_imagePaths),
color: contextMenuItem.action.getColorContextMenuIcon(),
width: 24,
height: 24
),
contextMenuItem.action.getTitleContextMenu(context),
mailbox,
absorbing: !contextMenuItem.isActivated,
opacity: !contextMenuItem.isActivated)
..onActionClick((mailbox) =>
controller.handleMailboxAction(context, contextMenuItem.action, mailbox)))
..actionTextStyle(textStyle: const TextStyle(
fontSize: 16,
color: Colors.black,
fontWeight: FontWeight.w500
))
..onActionClick((mailbox) => controller.handleMailboxAction(context, contextMenuItem.action, mailbox)))
.build();
}
@@ -495,15 +502,17 @@ class MailboxView extends GetWidget<MailboxController> with AppLoaderMixin, Popu
absorbing: !contextMenuItem.isActivated,
child: Opacity(
opacity: contextMenuItem.isActivated ? 1.0 : 0.3,
child: popupItem(contextMenuItem.action.getContextMenuIcon(_imagePaths),
contextMenuItem.action.getTitleContextMenu(context),
colorIcon: contextMenuItem.action.getColorContextMenuIcon(),
styleName: TextStyle(
fontWeight: FontWeight.normal,
fontSize: 17,
color: contextMenuItem.action.getColorContextMenuTitle()),
onCallbackAction: () =>
controller.handleMailboxAction(context, contextMenuItem.action, mailbox)),
child: popupItem(
contextMenuItem.action.getContextMenuIcon(_imagePaths),
contextMenuItem.action.getTitleContextMenu(context),
colorIcon: contextMenuItem.action.getColorContextMenuIcon(),
styleName: TextStyle(
fontWeight: FontWeight.w500,
fontSize: 16,
color: contextMenuItem.action.getColorContextMenuTitle()
),
onCallbackAction: () => controller.handleMailboxAction(context, contextMenuItem.action, mailbox)
),
),
));
}
@@ -69,15 +69,15 @@ extension MailboxActionsExtension on MailboxActions {
case MailboxActions.enableSpamReport:
return imagePaths.icSpamReportEnable;
case MailboxActions.markAsRead:
return imagePaths.icRead;
return imagePaths.icMarkAsRead;
case MailboxActions.move:
return imagePaths.icMove;
return imagePaths.icMoveMailbox;
case MailboxActions.rename:
return imagePaths.icRenameMailbox;
case MailboxActions.delete:
return imagePaths.icDelete;
return imagePaths.icDeleteMailbox;
case MailboxActions.disableMailbox:
return imagePaths.icEyeOff;
return imagePaths.icHideMailbox;
default:
return '';
}
@@ -96,12 +96,8 @@ extension MailboxActionsExtension on MailboxActions {
switch(this) {
case MailboxActions.delete:
return AppColor.colorActionDeleteConfirmDialog;
case MailboxActions.disableSpamReport:
case MailboxActions.enableSpamReport:
case MailboxActions.disableMailbox:
return AppColor.primaryColor;
default:
return Colors.black;
return AppColor.primaryColor;
}
}
@@ -8,6 +8,7 @@ typedef OnClickOpenMailboxAction = void Function(PresentationMailbox);
typedef OnClickOpenMenuMailboxAction = void Function(RelativeRect, PresentationMailbox);
typedef OnSelectMailboxAction = void Function(PresentationMailbox);
typedef OnDragEmailToMailboxAccepted = void Function(List<PresentationEmail>, PresentationMailbox);
typedef OnLongPressMailboxAction = void Function(PresentationMailbox);
typedef OnClickExpandMailboxNodeAction = void Function(MailboxNode);
typedef OnClickOpenMailboxNodeAction = void Function(MailboxNode);
@@ -30,7 +30,7 @@ class MailBoxFolderTileBuilder {
OnSelectMailboxNodeAction? _onSelectMailboxFolderClick;
OnClickOpenMenuMailboxNodeAction? _onMenuActionClick;
OnDragEmailToMailboxAccepted? _onDragItemAccepted;
OnLongPressMailboxNodeAction? _onLongPressSpamReport;
OnLongPressMailboxNodeAction? _onLongPressMailboxNodeAction;
bool isHoverItem = false;
@@ -68,8 +68,8 @@ class MailBoxFolderTileBuilder {
_onDragItemAccepted = onDragItemAccepted;
}
void addOnLongPressMailboxNodeAction(OnLongPressMailboxNodeAction onLongPressSpamReport) {
_onLongPressSpamReport = onLongPressSpamReport;
void addOnLongPressMailboxNodeAction(OnLongPressMailboxNodeAction onLongPressMailboxNodeAction) {
_onLongPressMailboxNodeAction = onLongPressMailboxNodeAction;
}
Widget build() => DragTarget<List<PresentationEmail>>(
@@ -1,4 +1,5 @@
import 'package:core/core.dart';
import 'package:core/presentation/extensions/color_extension.dart';
import 'package:core/presentation/resources/image_paths.dart';
import 'package:core/presentation/state/failure.dart';
@@ -150,8 +151,9 @@ class SearchMailboxController extends BaseMailboxController with MailboxActionHa
final newMailboxState = mailboxState ?? currentMailboxState;
dashboardController.dispatchMailboxUIAction(RefreshChangeMailboxAction(newMailboxState));
final accountId = dashboardController.accountId.value;
if (accountId != null && newMailboxState != null) {
consumeState(_refreshAllMailboxInteractor.execute(accountId, newMailboxState));
final session = dashboardController.sessionCurrent;
if (session != null && accountId != null && newMailboxState != null) {
consumeState(_refreshAllMailboxInteractor.execute(session, accountId, newMailboxState));
}
}
@@ -362,6 +364,14 @@ class SearchMailboxController extends BaseMailboxController with MailboxActionHa
}
}
void openMailboxAction(BuildContext context, PresentationMailbox mailbox) {
dashboardController.openMailboxAction(context, mailbox);
if (!responsiveUtils.isWebDesktop(context)) {
closeSearchView(context);
}
}
void clearAllTextInputSearchForm() {
textInputSearchController.clear();
currentSearchQuery.value = '';
@@ -1,4 +1,5 @@
import 'package:core/core.dart';
import 'package:core/presentation/extensions/color_extension.dart';
import 'package:core/presentation/views/button/icon_button_web.dart';
import 'package:core/presentation/views/text/text_field_builder.dart';
@@ -43,7 +44,7 @@ class SearchMailboxView extends GetWidget<SearchMailboxController>
if (!controller.responsiveUtils.isWebDesktop(context))
const Divider(color: AppColor.colorDividerComposer, height: 1),
_buildLoadingView(),
Expanded(child: _buildMailboxListView())
Expanded(child: _buildMailboxListView(context))
]),
),
),
@@ -68,9 +69,9 @@ class SearchMailboxView extends GetWidget<SearchMailboxController>
Widget _buildSearchInputForm(BuildContext context) {
return Row(children: [
buildIconWeb(
minSize: 30,
minSize: SearchMailboxUtils.getIconSize(context, controller.responsiveUtils),
iconPadding: EdgeInsets.zero,
splashRadius: 10,
splashRadius: SearchMailboxUtils.getIconSplashRadius(context, controller.responsiveUtils),
icon: SvgPicture.asset(
controller.imagePaths.icBack,
color: AppColor.colorTextButton,
@@ -89,7 +90,7 @@ class SearchMailboxView extends GetWidget<SearchMailboxController>
alignment: Alignment.center,
child: Row(children: [
Padding(
padding: const EdgeInsets.only(left: 5, right: 2),
padding: SearchMailboxUtils.getPaddingInputSearchIcon(context, controller.responsiveUtils),
child: buildIconWeb(
minSize: 40,
iconPadding: EdgeInsets.zero,
@@ -157,10 +158,10 @@ class SearchMailboxView extends GetWidget<SearchMailboxController>
)).build();
}
Widget _buildMailboxListView() {
Widget _buildMailboxListView(BuildContext context) {
return Obx(() {
return ListView.builder(
padding: const EdgeInsets.only(left: 16, right: 16, bottom: 16),
padding: SearchMailboxUtils.getPaddingListViewMailboxSearched(context, controller.responsiveUtils),
key: const Key('list_mailbox_searched'),
itemCount: controller.listMailboxSearched.length,
shrinkWrap: true,
@@ -171,8 +172,9 @@ class SearchMailboxView extends GetWidget<SearchMailboxController>
controller.responsiveUtils,
controller.listMailboxSearched[index],
onDragEmailToMailboxAccepted: controller.dashboardController.dragSelectedMultipleEmailToMailboxAction,
onClickOpenMailboxAction: (mailbox) => controller.dashboardController.openMailboxAction(context, mailbox),
onClickOpenMenuMailboxAction: (position, mailbox) => _openMailboxMenuAction(context, position, mailbox),
onClickOpenMailboxAction: (mailbox) => controller.openMailboxAction(context, mailbox),
onClickOpenMenuMailboxAction: (position, mailbox) => _openMailboxMenuAction(context, mailbox, position: position),
onLongPressMailboxAction: (mailbox) => _openMailboxMenuAction(context, mailbox),
);
}
);
@@ -185,7 +187,11 @@ class SearchMailboxView extends GetWidget<SearchMailboxController>
: MailboxActions.enableSpamReport;
}
void _openMailboxMenuAction(BuildContext context, RelativeRect position, PresentationMailbox mailbox) {
void _openMailboxMenuAction(
BuildContext context,
PresentationMailbox mailbox,
{RelativeRect? position}
) {
final mailboxActionsSupported = [
MailboxActions.openInNewTab,
if (mailbox.isPersonal && mailbox.isSpam)
@@ -241,6 +247,8 @@ class SearchMailboxView extends GetWidget<SearchMailboxController>
Key('${contextMenuItem.action.name}_action'),
SvgPicture.asset(
contextMenuItem.action.getContextMenuIcon(controller.imagePaths),
width: 24,
height: 24,
color: contextMenuItem.action.getColorContextMenuIcon()
),
contextMenuItem.action.getTitleContextMenu(context),
@@ -279,6 +287,7 @@ class SearchMailboxView extends GetWidget<SearchMailboxController>
child: popupItem(contextMenuItem.action.getContextMenuIcon(controller.imagePaths),
contextMenuItem.action.getTitleContextMenu(context),
colorIcon: contextMenuItem.action.getColorContextMenuIcon(),
iconSize: 24,
styleName: TextStyle(
fontWeight: FontWeight.w500,
fontSize: 16,
@@ -7,9 +7,49 @@ class SearchMailboxUtils {
return const EdgeInsets.symmetric(vertical: 8, horizontal: 16);
} else {
if (responsiveUtils.isScreenWithShortestSide(context)) {
return const EdgeInsets.symmetric(horizontal: 10);
return const EdgeInsets.symmetric(horizontal: 16, vertical: 8);
} else {
return const EdgeInsets.symmetric(horizontal: 32);
return const EdgeInsets.symmetric(horizontal: 32, vertical: 8);
}
}
}
static EdgeInsets getPaddingInputSearchIcon(BuildContext context, ResponsiveUtils responsiveUtils) {
if (responsiveUtils.isWebDesktop(context)) {
return const EdgeInsets.only(left: 5, right: 2);
} else {
if (responsiveUtils.isScreenWithShortestSide(context)) {
return const EdgeInsets.only(left: 10, right: 16);
} else {
return const EdgeInsets.only(left: 10, right: 16);
}
}
}
static double getIconSize(BuildContext context, ResponsiveUtils responsiveUtils) {
if (responsiveUtils.isWebDesktop(context)) {
return 30;
} else {
return 40;
}
}
static double getIconSplashRadius(BuildContext context, ResponsiveUtils responsiveUtils) {
if (responsiveUtils.isWebDesktop(context)) {
return 10;
} else {
return 15;
}
}
static EdgeInsets getPaddingListViewMailboxSearched(BuildContext context, ResponsiveUtils responsiveUtils) {
if (responsiveUtils.isWebDesktop(context)) {
return const EdgeInsets.only(left: 16, right: 16, bottom: 16);
} else {
if (responsiveUtils.isScreenWithShortestSide(context)) {
return const EdgeInsets.all(16);
} else {
return const EdgeInsets.symmetric(horizontal: 32, vertical: 16);
}
}
}
@@ -18,6 +18,7 @@ class MailboxSearchedItemBuilder extends StatefulWidget {
final OnClickOpenMailboxAction? onClickOpenMailboxAction;
final OnClickOpenMenuMailboxAction? onClickOpenMenuMailboxAction;
final OnDragEmailToMailboxAccepted? onDragEmailToMailboxAccepted;
final OnLongPressMailboxAction? onLongPressMailboxAction;
const MailboxSearchedItemBuilder(
this._imagePaths,
@@ -27,7 +28,8 @@ class MailboxSearchedItemBuilder extends StatefulWidget {
Key? key,
this.onClickOpenMailboxAction,
this.onClickOpenMenuMailboxAction,
this.onDragEmailToMailboxAccepted
this.onDragEmailToMailboxAccepted,
this.onLongPressMailboxAction
}
) : super(key: key);
@@ -89,6 +91,7 @@ class _MailboxSearchedItemBuilderState extends State<MailboxSearchedItemBuilder>
return ListTile(
contentPadding: const EdgeInsets.symmetric(horizontal: 8),
onTap: _onTapMailboxAction,
onLongPress: _onLongPressMailboxAction,
leading: _buildMailboxIcon(),
title: _buildTitleItem(),
subtitle: _buildSubtitleItem()
@@ -102,6 +105,10 @@ class _MailboxSearchedItemBuilderState extends State<MailboxSearchedItemBuilder>
}
}
void _onLongPressMailboxAction() {
widget.onLongPressMailboxAction?.call(widget._presentationMailbox);
}
Widget _buildMailboxIcon() {
return SvgPicture.asset(
widget._presentationMailbox.isSubscribed?.value == true