Skip to content

armgit / ente

Public Imported from GitHub
0

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

added go to map widget to location search section

ashilknc05aa19c8ba2
diff --git a/lib/ui/viewer/search/result/go_to_map_widget.dart b/lib/ui/viewer/search/result/go_to_map_widget.dart
new file mode 100644
index 0000000000..bf76bdd5f5
--- /dev/null
+++ b/lib/ui/viewer/search/result/go_to_map_widget.dart
@@ -0,0 +1,67 @@
+import "package:flutter/cupertino.dart";
+import "package:flutter/material.dart";
+import "package:photos/services/search_service.dart";
+import "package:photos/theme/ente_theme.dart";
+import "package:photos/ui/map/enable_map.dart";
+import "package:photos/ui/map/map_screen.dart";
+
+class GoToMapWidget extends StatelessWidget {
+ const GoToMapWidget({super.key});
+
+ @override
+ Widget build(BuildContext context) {
+ final textScaleFactor = MediaQuery.textScaleFactorOf(context);
+ late final double width;
+ if (textScaleFactor <= 1.0) {
+ width = 85.0;
+ } else {
+ width = 85.0 + ((textScaleFactor - 1.0) * 64);
+ }
+
+ final colorScheme = getEnteColorScheme(context);
+ return GestureDetector(
+ onTap: () async {
+ final bool result = await requestForMapEnable(context);
+ if (result) {
+ Navigator.of(context).push(
+ MaterialPageRoute(
+ builder: (context) => MapScreen(
+ filesFutureFn: SearchService.instance.getAllFiles,
+ ),
+ ),
+ );
+ }
+ },
+ child: SizedBox(
+ width: width,
+ child: Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 10),
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ SizedBox(
+ width: 64,
+ height: 64,
+ child: Icon(
+ CupertinoIcons.map_fill,
+ color: colorScheme.strokeFaint,
+ size: 48,
+ ),
+ ),
+ const SizedBox(
+ height: 10,
+ ),
+ Text(
+ "Your map",
+ maxLines: 2,
+ textAlign: TextAlign.center,
+ overflow: TextOverflow.ellipsis,
+ style: getEnteTextTheme(context).mini,
+ ),
+ ],
+ ),
+ ),
+ ),
+ );
+ }
+}
diff --git a/lib/ui/viewer/search/search_section.dart b/lib/ui/viewer/search/search_section.dart
index 4c7e7a1c35..5eaec140e8 100644
--- a/lib/ui/viewer/search/search_section.dart
+++ b/lib/ui/viewer/search/search_section.dart
@@ -8,6 +8,7 @@ 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/gallery/collection_page.dart";
+import "package:photos/ui/viewer/search/result/go_to_map_widget.dart";
import "package:photos/ui/viewer/search/result/search_result_page.dart";
import 'package:photos/ui/viewer/search/result/search_section_result_page.dart';
import "package:photos/ui/viewer/search/search_section_cta.dart";
@@ -84,6 +85,9 @@ class SearchExampleRow extends StatelessWidget {
Widget build(BuildContext context) {
//Cannot use listView.builder here
final scrollableExamples = <Widget>[];
+ if (sectionType == SectionType.location) {
+ scrollableExamples.add(const GoToMapWidget());
+ }
reccomendations.forEachIndexed((index, element) {
scrollableExamples.add(
SearchExample(