π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Create SearchExample widget and use it on the serach tab passing it location tag search results for testing
ashilkn94b0256fc5f7
diff --git a/lib/ui/search_tab.dart b/lib/ui/search_tab.dartindex 3467597e47..292fa1058d 100644--- a/lib/ui/search_tab.dart+++ b/lib/ui/search_tab.dart@@ -56,7 +56,7 @@ class AllSearchSections extends StatefulWidget {class _AllSearchSectionsState extends State<AllSearchSections> {late Future<List<List<SearchResult>>> allFutures;- final locationTags = SectionType.location.getData(limit: 3);+ final locationTags = SectionType.location.getData(limit: 7);@overridevoid initState() {allFutures = Future.wait<List<SearchResult>>([locationTags]);@@ -79,7 +79,10 @@ class _AllSearchSectionsState extends State<AllSearchSections> {return ListView.builder(itemCount: searchTypes.length,itemBuilder: (context, index) {- return SearchSection(sectionType: searchTypes[index]);+ return SearchSection(+ sectionType: searchTypes[index],+ examples: snapshot.data!.first,+ );},);} else if (snapshot.hasError) {diff --git a/lib/ui/viewer/search/search_section.dart b/lib/ui/viewer/search/search_section.dartindex e9348bad8a..3455ea6947 100644--- a/lib/ui/viewer/search/search_section.dart+++ b/lib/ui/viewer/search/search_section.dart@@ -1,14 +1,19 @@+import "package:collection/collection.dart";import "package:flutter/material.dart";+import "package:photos/models/search/search_result.dart";import "package:photos/models/search/search_types.dart";import "package:photos/theme/ente_theme.dart";+import "package:photos/ui/viewer/file/thumbnail_widget.dart";import "package:photos/ui/viewer/search/search_section_cta.dart";class SearchSection extends StatelessWidget {final SectionType sectionType;+ final List<SearchResult> examples;const SearchSection({Key? key,required this.sectionType,+ required this.examples,}) : super(key: key);@override@@ -30,11 +35,12 @@ class SearchSection extends StatelessWidget {),const SizedBox(height: 16),// wrap below text in next line- Text(- sectionType.getEmptyStateText(context),- style: textTheme.smallMuted,- softWrap: true,- ),+ // Text(+ // sectionType.getEmptyStateText(context),+ // style: textTheme.smallMuted,+ // softWrap: true,+ // ),+ SearchExampleRow(examples),],),),@@ -47,3 +53,68 @@ class SearchSection extends StatelessWidget {);}}++class SearchExampleRow extends StatelessWidget {+ final List<SearchResult> reccomendations;++ const SearchExampleRow(this.reccomendations, {super.key});++ @override+ Widget build(BuildContext context) {+ //Cannot use listView.builder here+ final scrollableExamples = <Widget>[];+ reccomendations.forEachIndexed((index, element) {+ scrollableExamples.add(+ SearchExample(+ searchResult: reccomendations.elementAt(index),+ ),+ );+ });+ return SizedBox(+ child: SingleChildScrollView(+ scrollDirection: Axis.horizontal,+ child: Row(+ children: scrollableExamples,+ ),+ ),+ );+ }+}++class SearchExample extends StatelessWidget {+ final SearchResult searchResult;+ const SearchExample({required this.searchResult, super.key});++ @override+ Widget build(BuildContext context) {+ return SizedBox(+ width: 84,+ child: Padding(+ padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 8),+ child: Column(+ mainAxisSize: MainAxisSize.min,+ children: [+ SizedBox(+ width: 64,+ height: 64,+ child: ClipRRect(+ borderRadius: BorderRadius.circular(32),+ child: ThumbnailWidget(searchResult.previewThumbnail()!),+ ),+ ),+ const SizedBox(+ height: 10,+ ),+ Text(+ "Title is spread on max 2 lines",+ maxLines: 2,+ textAlign: TextAlign.center,+ overflow: TextOverflow.ellipsis,+ style: getEnteTextTheme(context).mini,+ ),+ ],+ ),+ ),+ );+ }+}