Skip to content

armgit / ente

Public Imported from GitHub
0

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

Make view all for search section functional

ashilkn25d5256c2a34
diff --git a/lib/ui/search_tab.dart b/lib/ui/search_tab.dart
index a986d0d2ed..65e406f603 100644
--- a/lib/ui/search_tab.dart
+++ b/lib/ui/search_tab.dart
@@ -50,6 +50,7 @@ class AllSearchSections extends StatefulWidget {
class _AllSearchSectionsState extends State<AllSearchSections> {
late Future<List<List<SearchResult>>> allSectionsExamples;
late List<Future<List<SearchResult>>> sectionExamples;
+ static const _limit = 7;
@override
void initState() {
@@ -65,7 +66,7 @@ class _AllSearchSectionsState extends State<AllSearchSections> {
sectionType == SectionType.content) {
continue;
}
- sectionExamples.add(sectionType.getData(limit: 7, context: context));
+ sectionExamples.add(sectionType.getData(limit: _limit, context: context));
}
allSectionsExamples = Future.wait<List<SearchResult>>(sectionExamples);
}
@@ -90,6 +91,7 @@ class _AllSearchSectionsState extends State<AllSearchSections> {
return SearchSection(
sectionType: searchTypes[index],
examples: snapshot.data!.elementAt(index),
+ limit: _limit,
);
},
);
diff --git a/lib/ui/viewer/search/search_section.dart b/lib/ui/viewer/search/search_section.dart
index e0c6213237..318b4df657 100644
--- a/lib/ui/viewer/search/search_section.dart
+++ b/lib/ui/viewer/search/search_section.dart
@@ -9,17 +9,20 @@ import "package:photos/ui/viewer/file/no_thumbnail_widget.dart";
import "package:photos/ui/viewer/file/thumbnail_widget.dart";
import "package:photos/ui/viewer/gallery/collection_page.dart";
import "package:photos/ui/viewer/search/result/search_result_page.dart";
+import "package:photos/ui/viewer/search/result/search_section_all_page.dart";
import "package:photos/ui/viewer/search/search_section_cta.dart";
import "package:photos/utils/navigation_util.dart";
class SearchSection extends StatelessWidget {
final SectionType sectionType;
final List<SearchResult> examples;
+ final int limit;
const SearchSection({
Key? key,
required this.sectionType,
required this.examples,
+ required this.limit,
}) : super(key: key);
@override
@@ -30,6 +33,7 @@ class SearchSection extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Padding(
padding: const EdgeInsets.all(12),
@@ -38,6 +42,23 @@ class SearchSection extends StatelessWidget {
style: textTheme.largeBold,
),
),
+ examples.length < (limit - 1)
+ ? const SizedBox.shrink()
+ : GestureDetector(
+ onTap: () {
+ routeToPage(
+ context,
+ SearchSectionResultPage(sectionType: sectionType),
+ );
+ },
+ child: Padding(
+ padding: const EdgeInsets.all(12),
+ child: Icon(
+ Icons.chevron_right_outlined,
+ color: getEnteColorScheme(context).strokeMuted,
+ ),
+ ),
+ ),
],
),
const SizedBox(height: 2),