Skip to content

armgit / ente

Public Imported from GitHub
0

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

show option to edit location data for photos that already have location data

ashilkn1339101d9410
diff --git a/lib/ui/viewer/file/file_details_widget.dart b/lib/ui/viewer/file/file_details_widget.dart
index 92e080cf7a..00ee29f37e 100644
--- a/lib/ui/viewer/file/file_details_widget.dart
+++ b/lib/ui/viewer/file/file_details_widget.dart
@@ -157,7 +157,7 @@ class _FileDetailsWidgetState extends State<FileDetailsWidget> {
? Column(
children: [
LocationTagsWidget(
- widget.file.location!,
+ widget.file,
),
const FileDetailsDivider(),
],
diff --git a/lib/ui/viewer/file_details/location_tags_widget.dart b/lib/ui/viewer/file_details/location_tags_widget.dart
index b8b5ab78ed..1f22121f1b 100644
--- a/lib/ui/viewer/file_details/location_tags_widget.dart
+++ b/lib/ui/viewer/file_details/location_tags_widget.dart
@@ -1,22 +1,25 @@
import "dart:async";
import "package:flutter/material.dart";
+import "package:modal_bottom_sheet/modal_bottom_sheet.dart";
import "package:photos/core/event_bus.dart";
import "package:photos/events/location_tag_updated_event.dart";
import "package:photos/generated/l10n.dart";
-import "package:photos/models/location/location.dart";
+import "package:photos/models/file/file.dart";
import "package:photos/services/location_service.dart";
import "package:photos/states/location_screen_state.dart";
+import "package:photos/theme/colors.dart";
import "package:photos/theme/ente_theme.dart";
import "package:photos/ui/components/buttons/chip_button_widget.dart";
import "package:photos/ui/components/info_item_widget.dart";
import 'package:photos/ui/viewer/location/add_location_sheet.dart';
import "package:photos/ui/viewer/location/location_screen.dart";
+import "package:photos/ui/viewer/location/update_location_data_widget.dart";
import "package:photos/utils/navigation_util.dart";
class LocationTagsWidget extends StatefulWidget {
- final Location centerPoint;
- const LocationTagsWidget(this.centerPoint, {super.key});
+ final EnteFile file;
+ const LocationTagsWidget(this.file, {super.key});
@override
State<LocationTagsWidget> createState() => _LocationTagsWidgetState();
@@ -58,13 +61,28 @@ class _LocationTagsWidgetState extends State<LocationTagsWidget> {
subtitleSection: locationTagChips,
hasChipButtons: hasChipButtons ?? true,
onTap: onTap,
+ editOnTap: () {
+ showBarModalBottomSheet(
+ shape: const RoundedRectangleBorder(
+ borderRadius: BorderRadius.vertical(
+ top: Radius.circular(5),
+ ),
+ ),
+ backgroundColor: getEnteColorScheme(context).backgroundElevated,
+ barrierColor: backdropFaintDark,
+ context: context,
+ builder: (context) {
+ return UpdateLocationDataWidget([widget.file]);
+ },
+ );
+ },
),
);
}
Future<List<Widget>> _getLocationTags() async {
final locationTags = await LocationService.instance
- .enclosingLocationTags(widget.centerPoint);
+ .enclosingLocationTags(widget.file.location!);
if (locationTags.isEmpty) {
if (mounted) {
setState(() {
@@ -73,7 +91,7 @@ class _LocationTagsWidgetState extends State<LocationTagsWidget> {
hasChipButtons = false;
onTap = () => showAddLocationSheet(
context,
- widget.centerPoint,
+ widget.file.location!,
);
});
}
@@ -112,7 +130,7 @@ class _LocationTagsWidgetState extends State<LocationTagsWidget> {
ChipButtonWidget(
null,
leadingIcon: Icons.add_outlined,
- onTap: () => showAddLocationSheet(context, widget.centerPoint),
+ onTap: () => showAddLocationSheet(context, widget.file.location!),
),
);
return result;