diff --git a/mobile/lib/services/search_service.dart b/mobile/lib/services/search_service.dart index 7a8943848..657727f9a 100644 --- a/mobile/lib/services/search_service.dart +++ b/mobile/lib/services/search_service.dart @@ -820,7 +820,8 @@ class SearchService { final files = clusterIdToFiles[clusterId]!; // final String clusterName = "ID:$clusterId, ${files.length}"; // final String clusterName = "${files.length}"; - const String clusterName = ""; + // const String clusterName = ""; + final String clusterName = "$clusterId"; if (clusterIDToPersonID[clusterId] != null) { throw Exception( diff --git a/mobile/lib/ui/viewer/search/result/searchable_item.dart b/mobile/lib/ui/viewer/search/result/searchable_item.dart index 327c2e899..f8e2ed1ac 100644 --- a/mobile/lib/ui/viewer/search/result/searchable_item.dart +++ b/mobile/lib/ui/viewer/search/result/searchable_item.dart @@ -30,6 +30,8 @@ class SearchableItemWidget extends StatelessWidget { final heroTagPrefix = additionalPrefix + searchResult.heroTag(); final textTheme = getEnteTextTheme(context); final colorScheme = getEnteColorScheme(context); + final bool isCluster = (searchResult.type() == ResultType.faces && + int.tryParse(searchResult.name()) != null); return GestureDetector( onTap: () { @@ -76,14 +78,16 @@ class SearchableItemWidget extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text( - searchResult.name(), - style: searchResult.type() == - ResultType.locationSuggestion - ? textTheme.bodyFaint - : textTheme.body, - overflow: TextOverflow.ellipsis, - ), + isCluster + ? const SizedBox.shrink() + : Text( + searchResult.name(), + style: searchResult.type() == + ResultType.locationSuggestion + ? textTheme.bodyFaint + : textTheme.body, + overflow: TextOverflow.ellipsis, + ), const SizedBox( height: 2, ), diff --git a/mobile/lib/ui/viewer/search_tab/people_section.dart b/mobile/lib/ui/viewer/search_tab/people_section.dart index e9d24a9e7..aed38809e 100644 --- a/mobile/lib/ui/viewer/search_tab/people_section.dart +++ b/mobile/lib/ui/viewer/search_tab/people_section.dart @@ -4,6 +4,7 @@ import "package:collection/collection.dart"; import "package:flutter/material.dart"; import "package:photos/core/constants.dart"; import "package:photos/events/event.dart"; +import "package:photos/face/model/person.dart"; import "package:photos/models/search/album_search_result.dart"; import "package:photos/models/search/generic_search_result.dart"; import "package:photos/models/search/recent_searches.dart"; @@ -13,6 +14,8 @@ import "package:photos/models/search/search_types.dart"; import "package:photos/theme/ente_theme.dart"; import "package:photos/ui/viewer/file/no_thumbnail_widget.dart"; import "package:photos/ui/viewer/file/thumbnail_widget.dart"; +import "package:photos/ui/viewer/people/add_person_action_sheet.dart"; +import "package:photos/ui/viewer/people/people_page.dart"; import 'package:photos/ui/viewer/search/result/person_face_widget.dart'; import "package:photos/ui/viewer/search/result/search_result_page.dart"; import 'package:photos/ui/viewer/search/result/search_section_all_page.dart'; @@ -190,6 +193,8 @@ class SearchExample extends StatelessWidget { @override Widget build(BuildContext context) { final textScaleFactor = MediaQuery.textScaleFactorOf(context); + final bool isCluster = (searchResult.type() == ResultType.faces && + int.tryParse(searchResult.name()) != null); late final double width; if (textScaleFactor <= 1.0) { width = 85.0; @@ -258,13 +263,43 @@ class SearchExample extends StatelessWidget { const SizedBox( height: 10, ), - Text( - searchResult.name(), - maxLines: 2, - textAlign: TextAlign.center, - overflow: TextOverflow.ellipsis, - style: getEnteTextTheme(context).mini, - ), + isCluster + ? GestureDetector( + onTap: () async { + final result = await showAssignPersonAction( + context, + clusterID: int.parse(searchResult.name()), + ); + if (result != null && result is PersonEntity) { + // Navigator.pop(context); + // ignore: unawaited_futures + routeToPage(context, PeoplePage(person: result)); + } + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + const Icon( + Icons.add_circle_outline_outlined, + size: 12, + ), + Text( + " name", + maxLines: 1, + textAlign: TextAlign.center, + overflow: TextOverflow.ellipsis, + style: getEnteTextTheme(context).mini, + ), + ], + ), + ) + : Text( + searchResult.name(), + maxLines: 2, + textAlign: TextAlign.center, + overflow: TextOverflow.ellipsis, + style: getEnteTextTheme(context).mini, + ), ], ), ),