π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Start Add location flow when clicked on locationSuggestion
Neeraj Gupta4cf56a2fa2f6
diff --git a/lib/services/search_service.dart b/lib/services/search_service.dartindex 484b692c88..9217bdcf4f 100644--- a/lib/services/search_service.dart+++ b/lib/services/search_service.dart@@ -3,6 +3,7 @@ import "dart:math";import "package:flutter/cupertino.dart";import "package:intl/intl.dart";import 'package:logging/logging.dart';+import "package:photos/core/constants.dart";import 'package:photos/core/event_bus.dart';import 'package:photos/data/holidays.dart';import 'package:photos/data/months.dart';@@ -17,6 +18,7 @@ import "package:photos/models/file/extensions/file_props.dart";import 'package:photos/models/file/file.dart';import 'package:photos/models/file/file_type.dart';import "package:photos/models/local_entity_data.dart";+import "package:photos/models/location/location.dart";import "package:photos/models/location_tag/location_tag.dart";import 'package:photos/models/search/album_search_result.dart';import 'package:photos/models/search/generic_search_result.dart';@@ -25,6 +27,7 @@ import 'package:photos/services/collections_service.dart';import "package:photos/services/location_service.dart";import 'package:photos/services/semantic_search/semantic_search_service.dart';import "package:photos/states/location_screen_state.dart";+import "package:photos/ui/viewer/location/add_location_sheet.dart";import "package:photos/ui/viewer/location/location_screen.dart";import 'package:photos/utils/date_time_util.dart';import "package:photos/utils/navigation_util.dart";@@ -772,6 +775,15 @@ class SearchService {ResultType.locationSuggestion,city.city,results[city]!,+ onResultTap: (ctx) {+ Navigator.of(ctx).pop();+ showAddLocationSheet(+ ctx,+ Location(latitude: city.lat, longitude: city.lng),+ name: city.city,+ radius: defaultCityRadius,+ );+ },),);}diff --git a/lib/states/location_state.dart b/lib/states/location_state.dartindex 5711b2af8d..3fc773b99a 100644--- a/lib/states/location_state.dart+++ b/lib/states/location_state.dart@@ -14,11 +14,14 @@ import "package:photos/utils/debouncer.dart";class LocationTagStateProvider extends StatefulWidget {final LocalEntity<LocationTag>? locationTagEntity;final Location? centerPoint;+ final double? radius;final Widget child;const LocationTagStateProvider(this.child, {this.centerPoint,this.locationTagEntity,+ // if the locationTagEntity is null, we use the centerPoint and radius+ this.radius,super.key,});@@ -47,9 +50,12 @@ class _LocationTagStateProviderState extends State<LocationTagStateProvider> {///If the location tag has a custom radius value, we add the custom radius///value to the list of default radius values only for this location tag and///keep it in the state of this widget.- _radiusValues = _getRadiusValuesOfLocTag(_locationTagEntity?.item.radius);+ _radiusValues = _getRadiusValuesOfLocTag(+ _locationTagEntity?.item.radius ?? widget.radius,+ );- _selectedRadius = _locationTagEntity?.item.radius ?? defaultRadiusValue;+ _selectedRadius =+ _locationTagEntity?.item.radius ?? widget.radius ?? defaultRadiusValue;_locTagEntityListener =Bus.instance.on<LocationTagUpdatedEvent>().listen((event) {diff --git a/lib/ui/viewer/location/add_location_sheet.dart b/lib/ui/viewer/location/add_location_sheet.dartindex ef6d0a537e..f2809d63a1 100644--- a/lib/ui/viewer/location/add_location_sheet.dart+++ b/lib/ui/viewer/location/add_location_sheet.dart@@ -22,14 +22,20 @@ import "package:photos/ui/viewer/location/radius_picker_widget.dart";showAddLocationSheet(BuildContext context,- Location coordinates,-) {+ Location coordinates, {+ String name = '',+ double radius = defaultRadiusValue,+}) {showBarModalBottomSheet(context: context,builder: (context) {return LocationTagStateProvider(centerPoint: coordinates,- const AddLocationSheet(),+ AddLocationSheet(+ radius: radius,+ name: name,+ ),+ radius: radius,);},shape: const RoundedRectangleBorder(@@ -45,7 +51,13 @@ showAddLocationSheet(}class AddLocationSheet extends StatefulWidget {- const AddLocationSheet({super.key});+ final double radius;+ final String name;+ const AddLocationSheet({+ super.key,+ this.radius = defaultRadiusValue,+ this.name = '',+ });@overrideState<AddLocationSheet> createState() => _AddLocationSheetState();@@ -61,8 +73,7 @@ class _AddLocationSheetState extends State<AddLocationSheet> {final ValueNotifier<bool> _submitNotifer = ValueNotifier(false);final ValueNotifier<bool> _cancelNotifier = ValueNotifier(false);- final ValueNotifier<double> _selectedRadiusNotifier =- ValueNotifier(defaultRadiusValue);+ late ValueNotifier<double> _selectedRadiusNotifier;final _focusNode = FocusNode();final _textEditingController = TextEditingController();final _isEmptyNotifier = ValueNotifier(true);@@ -70,8 +81,11 @@ class _AddLocationSheetState extends State<AddLocationSheet> {@overridevoid initState() {+ _textEditingController.text = widget.name;_focusNode.addListener(_focusNodeListener);+ _selectedRadiusNotifier = ValueNotifier(widget.radius);_selectedRadiusNotifier.addListener(_selectedRadiusListener);+super.initState();}