#861 strip unlocated
filter from context collection when editing location via map
This commit is contained in:
parent
e2cce43620
commit
b57253c251
4 changed files with 19 additions and 6 deletions
|
@ -8,6 +8,10 @@ All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
- Collection: allow hiding thumbnail overlay HDR icon
|
- Collection: allow hiding thumbnail overlay HDR icon
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Info: strip `unlocated` filter from context collection when editing location via map
|
||||||
|
|
||||||
## <a id="v1.10.2"></a>[v1.10.2] - 2023-12-24
|
## <a id="v1.10.2"></a>[v1.10.2] - 2023-12-24
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
|
@ -15,6 +15,11 @@ class LocationFilter extends CoveredCollectionFilter {
|
||||||
late final String? _code;
|
late final String? _code;
|
||||||
late final EntryFilter _test;
|
late final EntryFilter _test;
|
||||||
|
|
||||||
|
static final unlocated = LocationFilter(LocationLevel.place, '');
|
||||||
|
static final located = unlocated.reverse();
|
||||||
|
|
||||||
|
bool get _isUnlocated => _location.isEmpty;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
List<Object?> get props => [level, _location, _code, reversed];
|
List<Object?> get props => [level, _location, _code, reversed];
|
||||||
|
|
||||||
|
@ -23,7 +28,7 @@ class LocationFilter extends CoveredCollectionFilter {
|
||||||
_location = split.isNotEmpty ? split[0] : location;
|
_location = split.isNotEmpty ? split[0] : location;
|
||||||
_code = split.length > 1 ? split[1] : null;
|
_code = split.length > 1 ? split[1] : null;
|
||||||
|
|
||||||
if (_location.isEmpty) {
|
if (_isUnlocated) {
|
||||||
_test = (entry) => !entry.hasGps;
|
_test = (entry) => !entry.hasGps;
|
||||||
} else {
|
} else {
|
||||||
switch (level) {
|
switch (level) {
|
||||||
|
@ -81,11 +86,11 @@ class LocationFilter extends CoveredCollectionFilter {
|
||||||
String get universalLabel => _location;
|
String get universalLabel => _location;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String getLabel(BuildContext context) => _location.isEmpty ? context.l10n.filterNoLocationLabel : _location;
|
String getLabel(BuildContext context) => _isUnlocated ? context.l10n.filterNoLocationLabel : _location;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget iconBuilder(BuildContext context, double size, {bool showGenericIcon = true}) {
|
Widget iconBuilder(BuildContext context, double size, {bool showGenericIcon = true}) {
|
||||||
if (_location.isEmpty) {
|
if (_isUnlocated) {
|
||||||
return Icon(AIcons.locationUnlocated, size: size);
|
return Icon(AIcons.locationUnlocated, size: size);
|
||||||
}
|
}
|
||||||
switch (level) {
|
switch (level) {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import 'package:aves/model/entry/entry.dart';
|
import 'package:aves/model/entry/entry.dart';
|
||||||
import 'package:aves/model/entry/extensions/location.dart';
|
import 'package:aves/model/entry/extensions/location.dart';
|
||||||
import 'package:aves/model/entry/extensions/metadata_edition.dart';
|
import 'package:aves/model/entry/extensions/metadata_edition.dart';
|
||||||
|
import 'package:aves/model/filters/location.dart';
|
||||||
import 'package:aves/model/settings/enums/coordinate_format.dart';
|
import 'package:aves/model/settings/enums/coordinate_format.dart';
|
||||||
import 'package:aves/model/settings/settings.dart';
|
import 'package:aves/model/settings/settings.dart';
|
||||||
import 'package:aves/model/source/collection_lens.dart';
|
import 'package:aves/model/source/collection_lens.dart';
|
||||||
|
@ -18,6 +19,7 @@ import 'package:aves/widgets/dialogs/item_picker.dart';
|
||||||
import 'package:aves/widgets/dialogs/pick_dialogs/item_pick_page.dart';
|
import 'package:aves/widgets/dialogs/pick_dialogs/item_pick_page.dart';
|
||||||
import 'package:aves/widgets/dialogs/pick_dialogs/location_pick_page.dart';
|
import 'package:aves/widgets/dialogs/pick_dialogs/location_pick_page.dart';
|
||||||
import 'package:aves_model/aves_model.dart';
|
import 'package:aves_model/aves_model.dart';
|
||||||
|
import 'package:collection/collection.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
import 'package:latlong2/latlong.dart';
|
import 'package:latlong2/latlong.dart';
|
||||||
|
@ -172,8 +174,10 @@ class _EditEntryLocationDialogState extends State<EditEntryLocationDialog> {
|
||||||
final mapCollection = baseCollection != null
|
final mapCollection = baseCollection != null
|
||||||
? CollectionLens(
|
? CollectionLens(
|
||||||
source: baseCollection.source,
|
source: baseCollection.source,
|
||||||
filters: baseCollection.filters,
|
filters: {
|
||||||
fixedSelection: baseCollection.sortedEntries.where((entry) => entry.hasGps).toList(),
|
...baseCollection.filters.whereNot((filter) => filter == LocationFilter.unlocated),
|
||||||
|
LocationFilter.located,
|
||||||
|
},
|
||||||
)
|
)
|
||||||
: null;
|
: null;
|
||||||
final latLng = await Navigator.maybeOf(context)?.push(
|
final latLng = await Navigator.maybeOf(context)?.push(
|
||||||
|
|
|
@ -279,7 +279,7 @@ class CollectionSearchDelegate extends AvesSearchDelegate with FeedbackMixin, Va
|
||||||
title: context.l10n.searchMetadataSectionTitle,
|
title: context.l10n.searchMetadataSectionTitle,
|
||||||
filters: [
|
filters: [
|
||||||
MissingFilter.date,
|
MissingFilter.date,
|
||||||
LocationFilter(LocationLevel.place, ''),
|
LocationFilter.unlocated,
|
||||||
MissingFilter.fineAddress,
|
MissingFilter.fineAddress,
|
||||||
TagFilter(''),
|
TagFilter(''),
|
||||||
RatingFilter(0),
|
RatingFilter(0),
|
||||||
|
|
Loading…
Reference in a new issue