Skip to content

armgit / ente

Public Imported from GitHub
0

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

show CTA tile in search section result's 'view all'

ashilkn6aef78a9a805
diff --git a/lib/models/search/search_types.dart b/lib/models/search/search_types.dart
index 2ba8c5718f..f886424b2f 100644
--- a/lib/models/search/search_types.dart
+++ b/lib/models/search/search_types.dart
@@ -118,7 +118,7 @@ extension SectionTypeExtensions on SectionType {
case SectionType.fileTypesAndExtension:
return false;
case SectionType.fileCaption:
- return true;
+ return false;
}
}
@@ -152,7 +152,7 @@ extension SectionTypeExtensions on SectionType {
case SectionType.moment:
return null;
case SectionType.location:
- return Icons.add_location_alt;
+ return Icons.add_location_alt_outlined;
case SectionType.people:
return Icons.adaptive.share;
case SectionType.album:
diff --git a/lib/ui/viewer/search/result/search_section_result_page.dart b/lib/ui/viewer/search/result/search_section_result_page.dart
index 8e902c2b16..7de93619e0 100644
--- a/lib/ui/viewer/search/result/search_section_result_page.dart
+++ b/lib/ui/viewer/search/result/search_section_result_page.dart
@@ -7,6 +7,7 @@ import "package:photos/ui/common/loading_widget.dart";
import "package:photos/ui/components/title_bar_title_widget.dart";
import "package:photos/ui/viewer/gallery/collection_page.dart";
import "package:photos/ui/viewer/search/result/search_result_widget.dart";
+import "package:photos/ui/viewer/search/search_section_cta.dart";
import "package:photos/utils/navigation_util.dart";
class SearchSectionResultPage extends StatefulWidget {
@@ -20,10 +21,12 @@ class SearchSectionResultPage extends StatefulWidget {
class _SearchSectionResultPageState extends State<SearchSectionResultPage> {
late final Future<List<SearchResult>> sectionData;
+ late final bool _showCTATile;
@override
void didChangeDependencies() {
super.didChangeDependencies();
sectionData = widget.sectionType.getData(limit: null, context: context);
+ _showCTATile = widget.sectionType.isCTAVisible;
}
@override
@@ -70,6 +73,9 @@ class _SearchSectionResultPageState extends State<SearchSectionResultPage> {
),
child: ListView.separated(
itemBuilder: (context, index) {
+ if (sectionResults.length == index) {
+ return SearchSectionCTATile(widget.sectionType);
+ }
if (sectionResults[index] is AlbumSearchResult) {
final albumSectionResult =
sectionResults[index] as AlbumSearchResult;
@@ -94,7 +100,7 @@ class _SearchSectionResultPageState extends State<SearchSectionResultPage> {
separatorBuilder: (context, index) {
return const SizedBox(height: 10);
},
- itemCount: sectionResults.length,
+ itemCount: sectionResults.length + (_showCTATile ? 1 : 0),
physics: const BouncingScrollPhysics(),
),
),
diff --git a/lib/ui/viewer/search/result/search_thumbnail_widget.dart b/lib/ui/viewer/search/result/search_thumbnail_widget.dart
index 4ddac81b04..d987a8a43c 100644
--- a/lib/ui/viewer/search/result/search_thumbnail_widget.dart
+++ b/lib/ui/viewer/search/result/search_thumbnail_widget.dart
@@ -21,7 +21,7 @@ class SearchThumbnailWidget extends StatelessWidget {
height: 60,
width: 60,
child: ClipRRect(
- borderRadius: BorderRadius.circular(4),
+ borderRadius: const BorderRadius.horizontal(left: Radius.circular(4)),
child: file != null
? ThumbnailWidget(
file!,
diff --git a/lib/ui/viewer/search/search_section_cta.dart b/lib/ui/viewer/search/search_section_cta.dart
index b8a74f0574..21e06850dc 100644
--- a/lib/ui/viewer/search/search_section_cta.dart
+++ b/lib/ui/viewer/search/search_section_cta.dart
@@ -57,3 +57,51 @@ class SearchSectionCTAIcon extends StatelessWidget {
);
}
}
+
+class SearchSectionCTATile extends StatelessWidget {
+ final SectionType sectionType;
+ const SearchSectionCTATile(this.sectionType, {super.key});
+
+ @override
+ Widget build(BuildContext context) {
+ if (sectionType.isCTAVisible == false) {
+ return const SizedBox.shrink();
+ }
+
+ final colorScheme = getEnteColorScheme(context);
+ final textTheme = getEnteTextTheme(context);
+ return Padding(
+ padding: const EdgeInsets.only(right: 1),
+ child: DottedBorder(
+ strokeWidth: 2,
+ borderType: BorderType.RRect,
+ radius: const Radius.circular(4),
+ padding: EdgeInsets.zero,
+ dashPattern: const [4, 4],
+ color: colorScheme.strokeFainter,
+ child: Row(
+ children: [
+ Container(
+ width: 60,
+ height: 60,
+ decoration: BoxDecoration(
+ borderRadius:
+ const BorderRadius.horizontal(left: Radius.circular(4)),
+ color: colorScheme.fillFaint,
+ ),
+ child: Icon(
+ sectionType.getCTAIcon(),
+ color: colorScheme.strokeMuted,
+ ),
+ ),
+ const SizedBox(width: 12),
+ Text(
+ sectionType.getCTAText(context),
+ style: textTheme.body,
+ ),
+ ],
+ ),
+ ),
+ );
+ }
+}