Location fixes (#1721)

This commit is contained in:
Neeraj Gupta 2024-02-15 23:16:25 +05:30 committed by GitHub
commit ea723f1183
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 8 deletions

View file

@ -731,6 +731,8 @@ class SearchService {
tagToItemsMap[tag]!.add(file);
}
}
// If the location tag already exists for a city, do not consider
// it for the city suggestions
if (!hasLocationTag) {
filesWithNoLocTag.add(file);
}
@ -769,14 +771,12 @@ class SearchService {
..sort((a, b) => results[b]!.length.compareTo(results[a]!.length));
for (final city in sortedByResultCount) {
if (results[city]!.length <= 1) continue;
// If the location tag already exists for a city, don't add it again
tagSearchResults.add(
GenericSearchResult(
ResultType.locationSuggestion,
city.city,
results[city]!,
onResultTap: (ctx) {
Navigator.of(ctx).pop();
showAddLocationSheet(
ctx,
Location(latitude: city.lat, longitude: city.lng),

View file

@ -76,12 +76,13 @@ class _AddLocationSheetState extends State<AddLocationSheet> {
late ValueNotifier<double> _selectedRadiusNotifier;
final _focusNode = FocusNode();
final _textEditingController = TextEditingController();
final _isEmptyNotifier = ValueNotifier(true);
late final ValueNotifier<bool> _isEmptyNotifier;
Widget? _keyboardTopButtons;
@override
void initState() {
_textEditingController.text = widget.name;
_isEmptyNotifier = ValueNotifier(widget.name.isEmpty);
_focusNode.addListener(_focusNodeListener);
_selectedRadiusNotifier = ValueNotifier(widget.radius);
_selectedRadiusNotifier.addListener(_selectedRadiusListener);
@ -169,11 +170,12 @@ class _AddLocationSheetState extends State<AddLocationSheet> {
RadiusPickerWidget(
_selectedRadiusNotifier,
),
const SizedBox(height: 16),
Text(
S.of(context).locationTagFeatureDescription,
style: textTheme.smallMuted,
),
if (widget.name.isEmpty) const SizedBox(height: 16),
if (widget.name.isEmpty)
Text(
S.of(context).locationTagFeatureDescription,
style: textTheme.smallMuted,
),
],
),
),