TF-691 Hide advanced search menu overlay when click outside menu
This commit is contained in:
@@ -161,10 +161,17 @@ class MailboxDashBoardView extends BaseMailboxDashBoardView {
|
|||||||
}),
|
}),
|
||||||
const SizedBox(width: 16),
|
const SizedBox(width: 16),
|
||||||
Obx(() => !searchController.isSearchActive() ? const Spacer() : const SizedBox.shrink()),
|
Obx(() => !searchController.isSearchActive() ? const Spacer() : const SizedBox.shrink()),
|
||||||
Obx(() => searchController.isSearchActive()
|
Obx(() {
|
||||||
? Expanded(child: _buildSearchForm(context))
|
if (searchController.isSearchActive()) {
|
||||||
: PortalTarget(
|
return Expanded(child: _buildSearchForm(context));
|
||||||
visible: controller.searchController.isAdvancedSearchViewOpen.isTrue,
|
} else {
|
||||||
|
return PortalTarget(
|
||||||
|
visible: searchController.isAdvancedSearchViewOpen.isTrue,
|
||||||
|
portalFollower: GestureDetector(
|
||||||
|
behavior: HitTestBehavior.opaque,
|
||||||
|
onTap: () => searchController.selectOpenAdvanceSearch()),
|
||||||
|
child: PortalTarget(
|
||||||
|
visible: searchController.isAdvancedSearchViewOpen.isTrue,
|
||||||
anchor: const Aligned(
|
anchor: const Aligned(
|
||||||
follower: Alignment.topRight,
|
follower: Alignment.topRight,
|
||||||
target: Alignment.bottomRight,
|
target: Alignment.bottomRight,
|
||||||
@@ -175,14 +182,19 @@ class MailboxDashBoardView extends BaseMailboxDashBoardView {
|
|||||||
widthFactor: 3,
|
widthFactor: 3,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
portalFollower: responsiveUtils.isMobile(context) ? const SizedBox.shrink() : const AdvancedSearchFilterOverlay(),
|
portalFollower: responsiveUtils.isMobile(context)
|
||||||
|
? const SizedBox.shrink()
|
||||||
|
: const AdvancedSearchFilterOverlay(),
|
||||||
child: (SearchBarView(imagePaths)
|
child: (SearchBarView(imagePaths)
|
||||||
..hintTextSearch(AppLocalizations.of(context).search_emails)
|
..hintTextSearch(AppLocalizations.of(context).search_emails)
|
||||||
..maxSizeWidth(240)
|
..maxSizeWidth(240)
|
||||||
..addOnOpenSearchViewAction(() => searchController.enableSearch())
|
..addOnOpenSearchViewAction(() => searchController.enableSearch())
|
||||||
..addRightButton(IconOpenAdvancedSearchWidget(context)))
|
..addRightButton(IconOpenAdvancedSearchWidget(context)))
|
||||||
.build(),
|
.build(),
|
||||||
)),
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}),
|
||||||
Obx(() => !searchController.isSearchActive() ? const SizedBox(width: 16) : const SizedBox.shrink()),
|
Obx(() => !searchController.isSearchActive() ? const SizedBox(width: 16) : const SizedBox.shrink()),
|
||||||
Obx(() => (AvatarBuilder()
|
Obx(() => (AvatarBuilder()
|
||||||
..text(controller.userProfile.value?.getAvatarText() ?? '')
|
..text(controller.userProfile.value?.getAvatarText() ?? '')
|
||||||
@@ -429,166 +441,174 @@ class MailboxDashBoardView extends BaseMailboxDashBoardView {
|
|||||||
height: 45,
|
height: 45,
|
||||||
child: PortalTarget(
|
child: PortalTarget(
|
||||||
visible: searchController.isAdvancedSearchViewOpen.isTrue,
|
visible: searchController.isAdvancedSearchViewOpen.isTrue,
|
||||||
anchor: const Aligned(
|
portalFollower: GestureDetector(
|
||||||
follower: Alignment.topLeft,
|
behavior: HitTestBehavior.opaque,
|
||||||
target: Alignment.bottomLeft,
|
onTap: () => searchController.selectOpenAdvanceSearch()),
|
||||||
widthFactor: 1,
|
child: PortalTarget(
|
||||||
backup: Aligned(
|
visible: searchController.isAdvancedSearchViewOpen.isTrue,
|
||||||
|
anchor: const Aligned(
|
||||||
follower: Alignment.topLeft,
|
follower: Alignment.topLeft,
|
||||||
target: Alignment.bottomLeft,
|
target: Alignment.bottomLeft,
|
||||||
widthFactor: 1,
|
widthFactor: 1,
|
||||||
|
backup: Aligned(
|
||||||
|
follower: Alignment.topLeft,
|
||||||
|
target: Alignment.bottomLeft,
|
||||||
|
widthFactor: 1,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
portalFollower: responsiveUtils.isMobile(context)
|
||||||
portalFollower: const AdvancedSearchFilterOverlay(),
|
? const SizedBox.shrink()
|
||||||
child: QuickSearchInputForm<PresentationEmail, RecentSearch>(
|
: const AdvancedSearchFilterOverlay(),
|
||||||
textFieldConfiguration: QuickSearchTextFieldConfiguration(
|
child: QuickSearchInputForm<PresentationEmail, RecentSearch>(
|
||||||
controller: searchController.searchInputController,
|
textFieldConfiguration: QuickSearchTextFieldConfiguration(
|
||||||
autofocus: true,
|
controller: searchController.searchInputController,
|
||||||
enabled: searchController.isAdvancedSearchViewOpen.isFalse,
|
autofocus: true,
|
||||||
focusNode: searchController.searchFocus,
|
enabled: searchController.isAdvancedSearchViewOpen.isFalse,
|
||||||
textInputAction: TextInputAction.done,
|
focusNode: searchController.searchFocus,
|
||||||
onSubmitted: (keyword) {
|
textInputAction: TextInputAction.done,
|
||||||
if (keyword.trim().isNotEmpty) {
|
onSubmitted: (keyword) {
|
||||||
searchController.saveRecentSearch(RecentSearch.now(keyword));
|
|
||||||
}
|
|
||||||
controller.searchEmail(context, keyword);
|
|
||||||
},
|
|
||||||
onChanged: (query) {
|
|
||||||
log('MailboxDashBoardView::_buildSearchForm(): onChanged: $query');
|
|
||||||
searchController.onChangeTextSearch(query);
|
|
||||||
},
|
|
||||||
decoration: InputDecoration(
|
|
||||||
border: InputBorder.none,
|
|
||||||
focusedBorder: InputBorder.none,
|
|
||||||
enabledBorder: InputBorder.none,
|
|
||||||
contentPadding: EdgeInsets.zero,
|
|
||||||
hintText: AppLocalizations.of(context).search_mail,
|
|
||||||
hintStyle: const TextStyle(
|
|
||||||
color: AppColor.colorHintSearchBar,
|
|
||||||
fontSize: 17.0),
|
|
||||||
labelStyle: const TextStyle(
|
|
||||||
color: AppColor.colorHintSearchBar,
|
|
||||||
fontSize: 17.0)
|
|
||||||
),
|
|
||||||
leftButton: buildIconWeb(
|
|
||||||
icon: SvgPicture.asset(
|
|
||||||
imagePaths.icSearchBar,
|
|
||||||
width: 16,
|
|
||||||
height: 16,
|
|
||||||
fit: BoxFit.fill),
|
|
||||||
onTap: () {
|
|
||||||
final keyword = searchController.searchInputController.text;
|
|
||||||
if (keyword.trim().isNotEmpty) {
|
|
||||||
searchController.saveRecentSearch(RecentSearch.now(keyword));
|
|
||||||
}
|
|
||||||
controller.searchEmail(context, keyword);
|
|
||||||
}),
|
|
||||||
clearTextButton: buildIconWeb(
|
|
||||||
icon: SvgPicture.asset(
|
|
||||||
imagePaths.icClearTextSearch,
|
|
||||||
width: 16,
|
|
||||||
height: 16,
|
|
||||||
fit: BoxFit.fill),
|
|
||||||
onTap: () {
|
|
||||||
searchController.clearTextSearch();
|
|
||||||
}),
|
|
||||||
rightButton: IconOpenAdvancedSearchWidget(context)
|
|
||||||
),
|
|
||||||
suggestionsBoxDecoration: QuickSearchSuggestionsBoxDecoration(
|
|
||||||
color: Colors.white,
|
|
||||||
borderRadius: const BorderRadius.all(Radius.circular(16)),
|
|
||||||
constraints: BoxConstraints(
|
|
||||||
maxWidth: responsiveUtils.isDesktop(context)
|
|
||||||
? 556
|
|
||||||
: double.infinity),
|
|
||||||
),
|
|
||||||
debounceDuration: const Duration(milliseconds: 500),
|
|
||||||
listActionButton: const [
|
|
||||||
QuickSearchFilter.hasAttachment,
|
|
||||||
QuickSearchFilter.last7Days,
|
|
||||||
QuickSearchFilter.fromMe,
|
|
||||||
],
|
|
||||||
actionButtonBuilder: (context, filterAction) {
|
|
||||||
if (filterAction is QuickSearchFilter) {
|
|
||||||
return buildQuickSearchFilterButton(context, filterAction);
|
|
||||||
}
|
|
||||||
return const SizedBox.shrink();
|
|
||||||
},
|
|
||||||
buttonActionCallback: (filterAction) {
|
|
||||||
if (filterAction is QuickSearchFilter) {
|
|
||||||
controller.selectQuickSearchFilter(
|
|
||||||
quickSearchFilter: filterAction,
|
|
||||||
fromSuggestionBox: true,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
listActionPadding: const EdgeInsets.only(
|
|
||||||
left: 24, right: 24, top: 20, bottom: 12),
|
|
||||||
titleHeaderRecent: Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 8),
|
|
||||||
child: Text(AppLocalizations.of(context).recent,
|
|
||||||
style: const TextStyle(fontSize: 13.0,
|
|
||||||
color: AppColor.colorTextButtonHeaderThread,
|
|
||||||
fontWeight: FontWeight.w500)
|
|
||||||
)
|
|
||||||
),
|
|
||||||
buttonShowAllResult: (context, keyword) {
|
|
||||||
if (keyword is String) {
|
|
||||||
return InkWell(
|
|
||||||
onTap: () {
|
|
||||||
if (keyword.trim().isNotEmpty) {
|
if (keyword.trim().isNotEmpty) {
|
||||||
searchController.saveRecentSearch(RecentSearch.now(keyword));
|
searchController.saveRecentSearch(RecentSearch.now(keyword));
|
||||||
}
|
}
|
||||||
controller.searchEmail(context, keyword);
|
controller.searchEmail(context, keyword);
|
||||||
},
|
},
|
||||||
child: Padding(
|
onChanged: (query) {
|
||||||
padding: const EdgeInsets.symmetric(
|
log('MailboxDashBoardView::_buildSearchForm(): onChanged: $query');
|
||||||
horizontal: 24,
|
searchController.onChangeTextSearch(query);
|
||||||
vertical: 14),
|
},
|
||||||
child: Row(children: [
|
decoration: InputDecoration(
|
||||||
Text(AppLocalizations.of(context).showingResultsFor,
|
border: InputBorder.none,
|
||||||
style: const TextStyle(fontSize: 13.0,
|
focusedBorder: InputBorder.none,
|
||||||
color: AppColor.colorTextButtonHeaderThread,
|
enabledBorder: InputBorder.none,
|
||||||
fontWeight: FontWeight.w500)
|
contentPadding: EdgeInsets.zero,
|
||||||
),
|
hintText: AppLocalizations.of(context).search_mail,
|
||||||
const SizedBox(width: 4),
|
hintStyle: const TextStyle(
|
||||||
Expanded(child: Text('"$keyword"',
|
color: AppColor.colorHintSearchBar,
|
||||||
style: const TextStyle(
|
fontSize: 17.0),
|
||||||
fontSize: 13.0,
|
labelStyle: const TextStyle(
|
||||||
color: Colors.black,
|
color: AppColor.colorHintSearchBar,
|
||||||
fontWeight: FontWeight.w500)))
|
fontSize: 17.0)
|
||||||
])
|
|
||||||
),
|
),
|
||||||
);
|
leftButton: buildIconWeb(
|
||||||
} else {
|
icon: SvgPicture.asset(
|
||||||
|
imagePaths.icSearchBar,
|
||||||
|
width: 16,
|
||||||
|
height: 16,
|
||||||
|
fit: BoxFit.fill),
|
||||||
|
onTap: () {
|
||||||
|
final keyword = searchController.searchInputController.text;
|
||||||
|
if (keyword.trim().isNotEmpty) {
|
||||||
|
searchController.saveRecentSearch(RecentSearch.now(keyword));
|
||||||
|
}
|
||||||
|
controller.searchEmail(context, keyword);
|
||||||
|
}),
|
||||||
|
clearTextButton: buildIconWeb(
|
||||||
|
icon: SvgPicture.asset(
|
||||||
|
imagePaths.icClearTextSearch,
|
||||||
|
width: 16,
|
||||||
|
height: 16,
|
||||||
|
fit: BoxFit.fill),
|
||||||
|
onTap: () {
|
||||||
|
searchController.clearTextSearch();
|
||||||
|
}),
|
||||||
|
rightButton: IconOpenAdvancedSearchWidget(context)
|
||||||
|
),
|
||||||
|
suggestionsBoxDecoration: QuickSearchSuggestionsBoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
borderRadius: const BorderRadius.all(Radius.circular(16)),
|
||||||
|
constraints: BoxConstraints(
|
||||||
|
maxWidth: responsiveUtils.isDesktop(context)
|
||||||
|
? 556
|
||||||
|
: double.infinity),
|
||||||
|
),
|
||||||
|
debounceDuration: const Duration(milliseconds: 500),
|
||||||
|
listActionButton: const [
|
||||||
|
QuickSearchFilter.hasAttachment,
|
||||||
|
QuickSearchFilter.last7Days,
|
||||||
|
QuickSearchFilter.fromMe,
|
||||||
|
],
|
||||||
|
actionButtonBuilder: (context, filterAction) {
|
||||||
|
if (filterAction is QuickSearchFilter) {
|
||||||
|
return buildQuickSearchFilterButton(context, filterAction);
|
||||||
|
}
|
||||||
return const SizedBox.shrink();
|
return const SizedBox.shrink();
|
||||||
}
|
},
|
||||||
},
|
buttonActionCallback: (filterAction) {
|
||||||
loadingBuilder: (context) => Padding(
|
if (filterAction is QuickSearchFilter) {
|
||||||
padding: const EdgeInsets.only(bottom: 16),
|
controller.selectQuickSearchFilter(
|
||||||
child: loadingWidget,
|
quickSearchFilter: filterAction,
|
||||||
),
|
fromSuggestionBox: true,
|
||||||
fetchRecentActionCallback: (pattern) async {
|
);
|
||||||
return searchController.getAllRecentSearchAction(pattern);
|
}
|
||||||
},
|
},
|
||||||
itemRecentBuilder: (context, recent) {
|
listActionPadding: const EdgeInsets.only(
|
||||||
return RecentSearchItemTileWidget(recent);
|
left: 24, right: 24, top: 20, bottom: 12),
|
||||||
},
|
titleHeaderRecent: Padding(
|
||||||
onRecentSelected: (recent) {
|
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 8),
|
||||||
searchController.searchInputController.text = recent.value;
|
child: Text(AppLocalizations.of(context).recent,
|
||||||
controller.searchEmail(context, recent.value);
|
style: const TextStyle(fontSize: 13.0,
|
||||||
},
|
color: AppColor.colorTextButtonHeaderThread,
|
||||||
suggestionsCallback: (pattern) async {
|
fontWeight: FontWeight.w500)
|
||||||
return controller.quickSearchEmails();
|
)
|
||||||
},
|
),
|
||||||
itemBuilder: (context, email) {
|
buttonShowAllResult: (context, keyword) {
|
||||||
return EmailQuickSearchItemTileWidget(
|
if (keyword is String) {
|
||||||
email, controller.selectedMailbox.value);
|
return InkWell(
|
||||||
},
|
onTap: () {
|
||||||
onSuggestionSelected: (presentationEmail) async {
|
if (keyword.trim().isNotEmpty) {
|
||||||
controller.dispatchAction(
|
searchController.saveRecentSearch(RecentSearch.now(keyword));
|
||||||
OpenEmailDetailedAction(context, presentationEmail));
|
}
|
||||||
}),
|
controller.searchEmail(context, keyword);
|
||||||
|
},
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 24,
|
||||||
|
vertical: 14),
|
||||||
|
child: Row(children: [
|
||||||
|
Text(AppLocalizations.of(context).showingResultsFor,
|
||||||
|
style: const TextStyle(fontSize: 13.0,
|
||||||
|
color: AppColor.colorTextButtonHeaderThread,
|
||||||
|
fontWeight: FontWeight.w500)
|
||||||
|
),
|
||||||
|
const SizedBox(width: 4),
|
||||||
|
Expanded(child: Text('"$keyword"',
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 13.0,
|
||||||
|
color: Colors.black,
|
||||||
|
fontWeight: FontWeight.w500)))
|
||||||
|
])
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return const SizedBox.shrink();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
loadingBuilder: (context) => Padding(
|
||||||
|
padding: const EdgeInsets.only(bottom: 16),
|
||||||
|
child: loadingWidget,
|
||||||
|
),
|
||||||
|
fetchRecentActionCallback: (pattern) async {
|
||||||
|
return searchController.getAllRecentSearchAction(pattern);
|
||||||
|
},
|
||||||
|
itemRecentBuilder: (context, recent) {
|
||||||
|
return RecentSearchItemTileWidget(recent);
|
||||||
|
},
|
||||||
|
onRecentSelected: (recent) {
|
||||||
|
searchController.searchInputController.text = recent.value;
|
||||||
|
controller.searchEmail(context, recent.value);
|
||||||
|
},
|
||||||
|
suggestionsCallback: (pattern) async {
|
||||||
|
return controller.quickSearchEmails();
|
||||||
|
},
|
||||||
|
itemBuilder: (context, email) {
|
||||||
|
return EmailQuickSearchItemTileWidget(
|
||||||
|
email, controller.selectedMailbox.value);
|
||||||
|
},
|
||||||
|
onSuggestionSelected: (presentationEmail) async {
|
||||||
|
controller.dispatchAction(
|
||||||
|
OpenEmailDetailedAction(context, presentationEmail));
|
||||||
|
}),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
)),
|
)),
|
||||||
const SizedBox(width: 16),
|
const SizedBox(width: 16),
|
||||||
|
|||||||
@@ -171,22 +171,30 @@ class ThreadView extends GetWidget<ThreadController> with AppLoaderMixin,
|
|||||||
Widget _buildSearchFormInActive(BuildContext context) {
|
Widget _buildSearchFormInActive(BuildContext context) {
|
||||||
return PortalTarget(
|
return PortalTarget(
|
||||||
visible: controller.searchController.isAdvancedSearchViewOpen.isTrue,
|
visible: controller.searchController.isAdvancedSearchViewOpen.isTrue,
|
||||||
anchor: const Aligned(
|
portalFollower: GestureDetector(
|
||||||
follower: Alignment.topLeft,
|
behavior: HitTestBehavior.opaque,
|
||||||
target: Alignment.bottomLeft,
|
onTap: () => controller.searchController.selectOpenAdvanceSearch()),
|
||||||
widthFactor: 1,
|
child: PortalTarget(
|
||||||
backup: Aligned(
|
visible: controller.searchController.isAdvancedSearchViewOpen.isTrue,
|
||||||
|
anchor: const Aligned(
|
||||||
follower: Alignment.topLeft,
|
follower: Alignment.topLeft,
|
||||||
target: Alignment.bottomLeft,
|
target: Alignment.bottomLeft,
|
||||||
widthFactor: 1,
|
widthFactor: 1,
|
||||||
|
backup: Aligned(
|
||||||
|
follower: Alignment.topLeft,
|
||||||
|
target: Alignment.bottomLeft,
|
||||||
|
widthFactor: 1,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
|
portalFollower: _responsiveUtils.isMobile(context)
|
||||||
|
? const SizedBox.shrink()
|
||||||
|
: const AdvancedSearchFilterOverlay(),
|
||||||
|
child: (SearchBarView(_imagePaths)
|
||||||
|
..hintTextSearch(AppLocalizations.of(context).search_emails)
|
||||||
|
..addOnOpenSearchViewAction(() => controller.enableSearch(context))
|
||||||
|
..addRightButton(IconOpenAdvancedSearchWidget(context)))
|
||||||
|
.build(),
|
||||||
),
|
),
|
||||||
portalFollower: _responsiveUtils.isMobile(context) ? const SizedBox.shrink() : const AdvancedSearchFilterOverlay(),
|
|
||||||
child: (SearchBarView(_imagePaths)
|
|
||||||
..hintTextSearch(AppLocalizations.of(context).search_emails)
|
|
||||||
..addOnOpenSearchViewAction(() => controller.enableSearch(context))
|
|
||||||
..addRightButton(IconOpenAdvancedSearchWidget(context)))
|
|
||||||
.build(),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -206,163 +214,171 @@ class ThreadView extends GetWidget<ThreadController> with AppLoaderMixin,
|
|||||||
height: 45,
|
height: 45,
|
||||||
child: PortalTarget(
|
child: PortalTarget(
|
||||||
visible: controller.searchController.isAdvancedSearchViewOpen.isTrue,
|
visible: controller.searchController.isAdvancedSearchViewOpen.isTrue,
|
||||||
anchor: const Aligned(
|
portalFollower: GestureDetector(
|
||||||
follower: Alignment.topLeft,
|
behavior: HitTestBehavior.opaque,
|
||||||
target: Alignment.bottomLeft,
|
onTap: () => controller.searchController.selectOpenAdvanceSearch()),
|
||||||
widthFactor: 1,
|
child: PortalTarget(
|
||||||
backup: Aligned(
|
visible: controller.searchController.isAdvancedSearchViewOpen.isTrue,
|
||||||
|
anchor: const Aligned(
|
||||||
follower: Alignment.topLeft,
|
follower: Alignment.topLeft,
|
||||||
target: Alignment.bottomLeft,
|
target: Alignment.bottomLeft,
|
||||||
widthFactor: 1,
|
widthFactor: 1,
|
||||||
|
backup: Aligned(
|
||||||
|
follower: Alignment.topLeft,
|
||||||
|
target: Alignment.bottomLeft,
|
||||||
|
widthFactor: 1,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
portalFollower: _responsiveUtils.isMobile(context)
|
||||||
portalFollower: _responsiveUtils.isMobile(context) ? const SizedBox.shrink() : const AdvancedSearchFilterOverlay(),
|
? const SizedBox.shrink()
|
||||||
child: QuickSearchInputForm<PresentationEmail, RecentSearch>(
|
: const AdvancedSearchFilterOverlay(),
|
||||||
textFieldConfiguration: QuickSearchTextFieldConfiguration(
|
child: QuickSearchInputForm<PresentationEmail, RecentSearch>(
|
||||||
controller: controller.searchController.searchInputController,
|
textFieldConfiguration: QuickSearchTextFieldConfiguration(
|
||||||
autofocus: true,
|
controller: controller.searchController.searchInputController,
|
||||||
enabled: controller.searchController.isAdvancedSearchViewOpen.isFalse,
|
autofocus: true,
|
||||||
focusNode: controller.searchController.searchFocus,
|
enabled: controller.searchController.isAdvancedSearchViewOpen.isFalse,
|
||||||
textInputAction: TextInputAction.done,
|
focusNode: controller.searchController.searchFocus,
|
||||||
onSubmitted: (keyword) {
|
textInputAction: TextInputAction.done,
|
||||||
if (keyword.trim().isNotEmpty) {
|
onSubmitted: (keyword) {
|
||||||
controller.searchController.saveRecentSearch(RecentSearch.now(keyword));
|
|
||||||
}
|
|
||||||
controller.mailboxDashBoardController.searchEmail(context, keyword);
|
|
||||||
},
|
|
||||||
decoration: InputDecoration(
|
|
||||||
border: InputBorder.none,
|
|
||||||
focusedBorder: InputBorder.none,
|
|
||||||
enabledBorder: InputBorder.none,
|
|
||||||
contentPadding: EdgeInsets.zero,
|
|
||||||
hintText: AppLocalizations.of(context).search_mail,
|
|
||||||
hintStyle: const TextStyle(
|
|
||||||
color: AppColor.colorHintSearchBar,
|
|
||||||
fontSize: 17.0),
|
|
||||||
labelStyle: const TextStyle(
|
|
||||||
color: AppColor.colorHintSearchBar,
|
|
||||||
fontSize: 17.0)
|
|
||||||
),
|
|
||||||
leftButton: buildIconWeb(
|
|
||||||
icon: SvgPicture.asset(
|
|
||||||
_imagePaths.icSearchBar,
|
|
||||||
width: 16,
|
|
||||||
height: 16,
|
|
||||||
fit: BoxFit.fill),
|
|
||||||
onTap: () {
|
|
||||||
final keyword = controller.currentTextSearch;
|
|
||||||
if (keyword.trim().isNotEmpty) {
|
|
||||||
controller.searchController.saveRecentSearch(RecentSearch.now(keyword));
|
|
||||||
}
|
|
||||||
controller.mailboxDashBoardController.searchEmail(context, keyword);
|
|
||||||
}),
|
|
||||||
clearTextButton: buildIconWeb(
|
|
||||||
icon: SvgPicture.asset(
|
|
||||||
_imagePaths.icClearTextSearch,
|
|
||||||
width: 16,
|
|
||||||
height: 16,
|
|
||||||
fit: BoxFit.fill),
|
|
||||||
onTap: () {
|
|
||||||
controller.clearTextSearch();
|
|
||||||
}),
|
|
||||||
rightButton: IconOpenAdvancedSearchWidget(context)
|
|
||||||
),
|
|
||||||
suggestionsBoxDecoration: const QuickSearchSuggestionsBoxDecoration(
|
|
||||||
color: Colors.white,
|
|
||||||
borderRadius: BorderRadius.all(Radius.circular(16)),
|
|
||||||
),
|
|
||||||
debounceDuration: const Duration(milliseconds: 500),
|
|
||||||
hideSuggestionsBox: _responsiveUtils.isScreenWithShortestSide(context),
|
|
||||||
listActionButton: const [
|
|
||||||
QuickSearchFilter.hasAttachment,
|
|
||||||
QuickSearchFilter.last7Days,
|
|
||||||
QuickSearchFilter.fromMe,
|
|
||||||
],
|
|
||||||
actionButtonBuilder: (context, filterAction) {
|
|
||||||
if (filterAction is QuickSearchFilter) {
|
|
||||||
return _buildQuickSearchFilterButtonSuggestionBox(
|
|
||||||
context,
|
|
||||||
filterAction);
|
|
||||||
}
|
|
||||||
return const SizedBox.shrink();
|
|
||||||
},
|
|
||||||
buttonActionCallback: (filterAction) {
|
|
||||||
if (filterAction is QuickSearchFilter) {
|
|
||||||
controller.mailboxDashBoardController.selectQuickSearchFilter(
|
|
||||||
quickSearchFilter: filterAction,
|
|
||||||
fromSuggestionBox: true,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
listActionPadding: const EdgeInsets.only(
|
|
||||||
left: 24, right: 24, top: 20, bottom: 12),
|
|
||||||
titleHeaderRecent: Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 8),
|
|
||||||
child: Text(AppLocalizations.of(context).recent,
|
|
||||||
style: const TextStyle(fontSize: 13.0,
|
|
||||||
color: AppColor.colorTextButtonHeaderThread,
|
|
||||||
fontWeight: FontWeight.w500)
|
|
||||||
)
|
|
||||||
),
|
|
||||||
buttonShowAllResult: (context, keyword) {
|
|
||||||
if (keyword is String) {
|
|
||||||
return InkWell(
|
|
||||||
onTap: () {
|
|
||||||
if (keyword.trim().isNotEmpty) {
|
if (keyword.trim().isNotEmpty) {
|
||||||
controller.searchController.saveRecentSearch(RecentSearch.now(keyword));
|
controller.searchController.saveRecentSearch(RecentSearch.now(keyword));
|
||||||
}
|
}
|
||||||
controller.mailboxDashBoardController.searchEmail(context, keyword);
|
controller.mailboxDashBoardController.searchEmail(context, keyword);
|
||||||
},
|
},
|
||||||
child: Padding(
|
decoration: InputDecoration(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 14),
|
border: InputBorder.none,
|
||||||
child: Row(children: [
|
focusedBorder: InputBorder.none,
|
||||||
Text(AppLocalizations.of(context).showingResultsFor,
|
enabledBorder: InputBorder.none,
|
||||||
style: const TextStyle(fontSize: 13.0,
|
contentPadding: EdgeInsets.zero,
|
||||||
color: AppColor.colorTextButtonHeaderThread,
|
hintText: AppLocalizations.of(context).search_mail,
|
||||||
fontWeight: FontWeight.w500)
|
hintStyle: const TextStyle(
|
||||||
),
|
color: AppColor.colorHintSearchBar,
|
||||||
const SizedBox(width: 4),
|
fontSize: 17.0),
|
||||||
Expanded(child: Text('"$keyword"',
|
labelStyle: const TextStyle(
|
||||||
style: const TextStyle(
|
color: AppColor.colorHintSearchBar,
|
||||||
fontSize: 13.0,
|
fontSize: 17.0)
|
||||||
color: Colors.black,
|
|
||||||
fontWeight: FontWeight.w500)))
|
|
||||||
])
|
|
||||||
),
|
),
|
||||||
);
|
leftButton: buildIconWeb(
|
||||||
} else {
|
icon: SvgPicture.asset(
|
||||||
|
_imagePaths.icSearchBar,
|
||||||
|
width: 16,
|
||||||
|
height: 16,
|
||||||
|
fit: BoxFit.fill),
|
||||||
|
onTap: () {
|
||||||
|
final keyword = controller.currentTextSearch;
|
||||||
|
if (keyword.trim().isNotEmpty) {
|
||||||
|
controller.searchController.saveRecentSearch(RecentSearch.now(keyword));
|
||||||
|
}
|
||||||
|
controller.mailboxDashBoardController.searchEmail(context, keyword);
|
||||||
|
}),
|
||||||
|
clearTextButton: buildIconWeb(
|
||||||
|
icon: SvgPicture.asset(
|
||||||
|
_imagePaths.icClearTextSearch,
|
||||||
|
width: 16,
|
||||||
|
height: 16,
|
||||||
|
fit: BoxFit.fill),
|
||||||
|
onTap: () {
|
||||||
|
controller.clearTextSearch();
|
||||||
|
}),
|
||||||
|
rightButton: IconOpenAdvancedSearchWidget(context)
|
||||||
|
),
|
||||||
|
suggestionsBoxDecoration: const QuickSearchSuggestionsBoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
borderRadius: BorderRadius.all(Radius.circular(16)),
|
||||||
|
),
|
||||||
|
debounceDuration: const Duration(milliseconds: 500),
|
||||||
|
hideSuggestionsBox: _responsiveUtils.isScreenWithShortestSide(context),
|
||||||
|
listActionButton: const [
|
||||||
|
QuickSearchFilter.hasAttachment,
|
||||||
|
QuickSearchFilter.last7Days,
|
||||||
|
QuickSearchFilter.fromMe,
|
||||||
|
],
|
||||||
|
actionButtonBuilder: (context, filterAction) {
|
||||||
|
if (filterAction is QuickSearchFilter) {
|
||||||
|
return _buildQuickSearchFilterButtonSuggestionBox(
|
||||||
|
context,
|
||||||
|
filterAction);
|
||||||
|
}
|
||||||
return const SizedBox.shrink();
|
return const SizedBox.shrink();
|
||||||
}
|
},
|
||||||
},
|
buttonActionCallback: (filterAction) {
|
||||||
loadingBuilder: (context) => Padding(
|
if (filterAction is QuickSearchFilter) {
|
||||||
padding: const EdgeInsets.only(bottom: 16),
|
controller.mailboxDashBoardController.selectQuickSearchFilter(
|
||||||
child: loadingWidget,
|
quickSearchFilter: filterAction,
|
||||||
),
|
fromSuggestionBox: true,
|
||||||
fetchRecentActionCallback: (pattern) async {
|
);
|
||||||
return controller.searchController.getAllRecentSearchAction(pattern);
|
}
|
||||||
},
|
},
|
||||||
itemRecentBuilder: (context, recent) {
|
listActionPadding: const EdgeInsets.only(
|
||||||
return RecentSearchItemTileWidget(recent);
|
left: 24, right: 24, top: 20, bottom: 12),
|
||||||
},
|
titleHeaderRecent: Padding(
|
||||||
onRecentSelected: (recent) {
|
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 8),
|
||||||
controller.searchController.updateTextSearch(recent.value);
|
child: Text(AppLocalizations.of(context).recent,
|
||||||
controller.mailboxDashBoardController.searchEmail(context, recent.value);
|
style: const TextStyle(fontSize: 13.0,
|
||||||
},
|
color: AppColor.colorTextButtonHeaderThread,
|
||||||
suggestionsCallback: (pattern) async {
|
fontWeight: FontWeight.w500)
|
||||||
controller.searchController.updateFilterEmail(text: SearchQuery(pattern));
|
)
|
||||||
return controller.mailboxDashBoardController.quickSearchEmails();
|
),
|
||||||
},
|
buttonShowAllResult: (context, keyword) {
|
||||||
itemBuilder: (context, email) {
|
if (keyword is String) {
|
||||||
return EmailQuickSearchItemTileWidget(
|
return InkWell(
|
||||||
email,
|
onTap: () {
|
||||||
controller.currentMailbox);
|
if (keyword.trim().isNotEmpty) {
|
||||||
},
|
controller.searchController.saveRecentSearch(RecentSearch.now(keyword));
|
||||||
onSuggestionSelected: (presentationEmail) async {
|
}
|
||||||
controller.pressEmailAction(
|
controller.mailboxDashBoardController.searchEmail(context, keyword);
|
||||||
context,
|
},
|
||||||
EmailActionType.preview,
|
child: Padding(
|
||||||
presentationEmail);
|
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 14),
|
||||||
}),
|
child: Row(children: [
|
||||||
|
Text(AppLocalizations.of(context).showingResultsFor,
|
||||||
|
style: const TextStyle(fontSize: 13.0,
|
||||||
|
color: AppColor.colorTextButtonHeaderThread,
|
||||||
|
fontWeight: FontWeight.w500)
|
||||||
|
),
|
||||||
|
const SizedBox(width: 4),
|
||||||
|
Expanded(child: Text('"$keyword"',
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 13.0,
|
||||||
|
color: Colors.black,
|
||||||
|
fontWeight: FontWeight.w500)))
|
||||||
|
])
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return const SizedBox.shrink();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
loadingBuilder: (context) => Padding(
|
||||||
|
padding: const EdgeInsets.only(bottom: 16),
|
||||||
|
child: loadingWidget,
|
||||||
|
),
|
||||||
|
fetchRecentActionCallback: (pattern) async {
|
||||||
|
return controller.searchController.getAllRecentSearchAction(pattern);
|
||||||
|
},
|
||||||
|
itemRecentBuilder: (context, recent) {
|
||||||
|
return RecentSearchItemTileWidget(recent);
|
||||||
|
},
|
||||||
|
onRecentSelected: (recent) {
|
||||||
|
controller.searchController.updateTextSearch(recent.value);
|
||||||
|
controller.mailboxDashBoardController.searchEmail(context, recent.value);
|
||||||
|
},
|
||||||
|
suggestionsCallback: (pattern) async {
|
||||||
|
controller.searchController.updateFilterEmail(text: SearchQuery(pattern));
|
||||||
|
return controller.mailboxDashBoardController.quickSearchEmails();
|
||||||
|
},
|
||||||
|
itemBuilder: (context, email) {
|
||||||
|
return EmailQuickSearchItemTileWidget(
|
||||||
|
email,
|
||||||
|
controller.currentMailbox);
|
||||||
|
},
|
||||||
|
onSuggestionSelected: (presentationEmail) async {
|
||||||
|
controller.pressEmailAction(
|
||||||
|
context,
|
||||||
|
EmailActionType.preview,
|
||||||
|
presentationEmail);
|
||||||
|
}),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
)),
|
)),
|
||||||
const SizedBox(width: 16),
|
const SizedBox(width: 16),
|
||||||
|
|||||||
Reference in New Issue
Block a user