Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[mob][photos] Fix search results with wrong thumbnail and possible other wrong elements

ashilkne3ffe3e1f074
diff --git a/mobile/lib/ui/viewer/search/result/search_result_widget.dart b/mobile/lib/ui/viewer/search/result/search_result_widget.dart
index 5d8513118d..564d77e714 100644
--- a/mobile/lib/ui/viewer/search/result/search_result_widget.dart
+++ b/mobile/lib/ui/viewer/search/result/search_result_widget.dart
@@ -28,108 +28,111 @@ class SearchResultWidget extends StatelessWidget {
final heroTagPrefix = searchResult.heroTag();
final textTheme = getEnteTextTheme(context);
- return GestureDetector(
- behavior: HitTestBehavior.opaque,
- child: Container(
- decoration: BoxDecoration(
- borderRadius: const BorderRadius.all(Radius.circular(4)),
- border: Border.all(
- color: getEnteColorScheme(context).strokeFainter,
+ return SizedBox(
+ key: ValueKey(searchResult.hashCode),
+ child: GestureDetector(
+ behavior: HitTestBehavior.opaque,
+ child: Container(
+ decoration: BoxDecoration(
+ borderRadius: const BorderRadius.all(Radius.circular(4)),
+ border: Border.all(
+ color: getEnteColorScheme(context).strokeFainter,
+ ),
),
- ),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- crossAxisAlignment: CrossAxisAlignment.center,
- children: [
- searchResult.type() == ResultType.shared
- ? ContactSearchThumbnailWidget(
- heroTagPrefix,
- searchResult: searchResult as GenericSearchResult,
- )
- : SearchThumbnailWidget(
- searchResult.previewThumbnail(),
- heroTagPrefix,
- searchResult: searchResult,
- ),
- const SizedBox(width: 12),
- Padding(
- padding: const EdgeInsets.symmetric(vertical: 2),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- SizedBox(
- width: 220,
- child: Text(
- searchResult.name(),
- style: textTheme.body,
- overflow: TextOverflow.ellipsis,
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ crossAxisAlignment: CrossAxisAlignment.center,
+ children: [
+ searchResult.type() == ResultType.shared
+ ? ContactSearchThumbnailWidget(
+ heroTagPrefix,
+ searchResult: searchResult as GenericSearchResult,
+ )
+ : SearchThumbnailWidget(
+ searchResult.previewThumbnail(),
+ heroTagPrefix,
+ searchResult: searchResult,
),
- ),
- const SizedBox(height: 4),
- Row(
- children: [
- Text(
- _resultTypeName(searchResult.type()),
- style: textTheme.smallMuted,
+ const SizedBox(width: 12),
+ Padding(
+ padding: const EdgeInsets.symmetric(vertical: 2),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ SizedBox(
+ width: 220,
+ child: Text(
+ searchResult.name(),
+ style: textTheme.body,
+ overflow: TextOverflow.ellipsis,
),
- FutureBuilder<int>(
- future: resultCount ??
- Future.value(searchResult.resultFiles().length),
- builder: (context, snapshot) {
- if (snapshot.hasData && snapshot.data! > 0) {
- final noOfMemories = snapshot.data;
+ ),
+ const SizedBox(height: 4),
+ Row(
+ children: [
+ Text(
+ _resultTypeName(searchResult.type()),
+ style: textTheme.smallMuted,
+ ),
+ FutureBuilder<int>(
+ future: resultCount ??
+ Future.value(searchResult.resultFiles().length),
+ builder: (context, snapshot) {
+ if (snapshot.hasData && snapshot.data! > 0) {
+ final noOfMemories = snapshot.data;
- return Text(
- " \u2022 " +
- (noOfMemories! > 9999
- ? NumberFormat().format(noOfMemories)
- : noOfMemories.toString()),
- style: textTheme.smallMuted,
- );
- } else {
- return const SizedBox.shrink();
- }
- },
- ),
- ],
- ),
- ],
+ return Text(
+ " \u2022 " +
+ (noOfMemories! > 9999
+ ? NumberFormat().format(noOfMemories)
+ : noOfMemories.toString()),
+ style: textTheme.smallMuted,
+ );
+ } else {
+ return const SizedBox.shrink();
+ }
+ },
+ ),
+ ],
+ ),
+ ],
+ ),
),
- ),
- const Spacer(),
- Padding(
- padding: const EdgeInsets.all(16.0),
- child: Icon(
- Icons.chevron_right,
- color: Theme.of(context).colorScheme.subTextColor,
+ const Spacer(),
+ Padding(
+ padding: const EdgeInsets.all(16.0),
+ child: Icon(
+ Icons.chevron_right,
+ color: Theme.of(context).colorScheme.subTextColor,
+ ),
),
- ),
- ],
+ ],
+ ),
),
- ),
- onTap: () {
- RecentSearches().add(searchResult.name());
+ onTap: () {
+ RecentSearches().add(searchResult.name());
- if (onResultTap != null) {
- onResultTap!();
- } else {
- if (searchResult.type() == ResultType.shared) {
- routeToPage(
- context,
- ContactResultPage(
- searchResult,
- ),
- );
+ if (onResultTap != null) {
+ onResultTap!();
} else {
- routeToPage(
- context,
- SearchResultPage(
- searchResult,
- ),
- );
+ if (searchResult.type() == ResultType.shared) {
+ routeToPage(
+ context,
+ ContactResultPage(
+ searchResult,
+ ),
+ );
+ } else {
+ routeToPage(
+ context,
+ SearchResultPage(
+ searchResult,
+ ),
+ );
+ }
}
- }
- },
+ },
+ ),
);
}