diff --git a/lib/model/entry/extensions/metadata_edition.dart b/lib/model/entry/extensions/metadata_edition.dart index c28c26d8d..725505ee8 100644 --- a/lib/model/entry/extensions/metadata_edition.dart +++ b/lib/model/entry/extensions/metadata_edition.dart @@ -82,7 +82,7 @@ extension ExtraAvesEntryMetadataEdition on AvesEntry { return dataTypes; } - static final removalLocation = LatLng(0, 0); + static const removalLocation = LatLng(0, 0); Future> editLocation(LatLng? latLng) async { final dataTypes = {}; diff --git a/lib/ref/poi.dart b/lib/ref/poi.dart index 951239d39..1b7b3ee01 100644 --- a/lib/ref/poi.dart +++ b/lib/ref/poi.dart @@ -1,9 +1,9 @@ import 'package:latlong2/latlong.dart'; class PointsOfInterest { - static final pointNemo = LatLng(-48.876667, -123.393333); + static const pointNemo = LatLng(-48.876667, -123.393333); - static final wonders = [ + static const wonders = [ LatLng(29.979167, 31.134167), LatLng(36.451000, 28.223615), LatLng(32.5355, 44.4275), diff --git a/lib/widgets/common/map/leaflet/latlng_utils.dart b/lib/widgets/common/map/leaflet/latlng_utils.dart index 35867b4ec..adec5d192 100644 --- a/lib/widgets/common/map/leaflet/latlng_utils.dart +++ b/lib/widgets/common/map/leaflet/latlng_utils.dart @@ -4,8 +4,8 @@ class LatLngUtils { static LatLng? lerp(LatLng? a, LatLng? b, double t) { if (a == null && b == null) return null; - final _a = a ?? LatLng(0, 0); - final _b = b ?? LatLng(0, 0); + final _a = a ?? const LatLng(0, 0); + final _b = b ?? const LatLng(0, 0); return LatLng( _a.latitude + (_b.latitude - _a.latitude) * t, _a.longitude + (_b.longitude - _a.longitude) * t, diff --git a/plugins/aves_magnifier/lib/src/core/core.dart b/plugins/aves_magnifier/lib/src/core/core.dart index 53cb4da9a..bbb9fa2f3 100644 --- a/plugins/aves_magnifier/lib/src/core/core.dart +++ b/plugins/aves_magnifier/lib/src/core/core.dart @@ -12,7 +12,6 @@ import 'package:aves_utils/aves_utils.dart'; import 'package:equatable/equatable.dart'; import 'package:flutter/gestures.dart'; import 'package:flutter/widgets.dart'; -import 'package:tuple/tuple.dart'; /* adapted from package `photo_view` v0.9.2: @@ -162,7 +161,7 @@ class _AvesMagnifierState extends State with TickerProviderStateM Stopwatch? _scaleStopwatch; VelocityTracker? _velocityTracker; - var _mayFlingLTRB = const Tuple4(false, false, false, false); + var _mayFlingLTRB = const (false, false, false, false); void onScaleStart(ScaleStartDetails details, bool doubleTap) { final boundaries = scaleBoundaries; @@ -172,7 +171,7 @@ class _AvesMagnifierState extends State with TickerProviderStateM _scaleStopwatch = Stopwatch()..start(); _velocityTracker = VelocityTracker.withKind(_flingPointerKind); - _mayFlingLTRB = const Tuple4(true, true, true, true); + _mayFlingLTRB = const (true, true, true, true); _updateMayFling(); _startScale = scale; @@ -246,9 +245,8 @@ class _AvesMagnifierState extends State with TickerProviderStateM final estimate = _velocityTracker?.getVelocityEstimate(); final onFling = widget.onFling; if (estimate != null && onFling != null) { + final (left, up, right, down) = _mayFlingLTRB; if (_isFlingGesture(estimate, _flingPointerKind, Axis.horizontal)) { - final left = _mayFlingLTRB.item1; - final right = _mayFlingLTRB.item3; if (left ^ right) { if (left) { onFling(AxisDirection.left); @@ -257,8 +255,6 @@ class _AvesMagnifierState extends State with TickerProviderStateM } } } else if (_isFlingGesture(estimate, _flingPointerKind, Axis.vertical)) { - final up = _mayFlingLTRB.item2; - final down = _mayFlingLTRB.item4; if (up ^ down) { if (up) { onFling(AxisDirection.up); @@ -320,11 +316,12 @@ class _AvesMagnifierState extends State with TickerProviderStateM void _updateMayFling() { final xHit = getXEdgeHit(); final yHit = getYEdgeHit(); - _mayFlingLTRB = Tuple4( - _mayFlingLTRB.item1 && xHit.hasHitMin, - _mayFlingLTRB.item2 && yHit.hasHitMin, - _mayFlingLTRB.item3 && xHit.hasHitMax, - _mayFlingLTRB.item4 && yHit.hasHitMax, + final (left, up, right, down) = _mayFlingLTRB; + _mayFlingLTRB = ( + xHit.hasHitMin && left, + yHit.hasHitMin && up, + xHit.hasHitMax && right, + yHit.hasHitMax && down, ); } diff --git a/plugins/aves_magnifier/pubspec.lock b/plugins/aves_magnifier/pubspec.lock index 5f7bbc3f6..4ef092e2f 100644 --- a/plugins/aves_magnifier/pubspec.lock +++ b/plugins/aves_magnifier/pubspec.lock @@ -98,14 +98,6 @@ packages: description: flutter source: sdk version: "0.0.99" - tuple: - dependency: "direct main" - description: - name: tuple - sha256: "0ea99cd2f9352b2586583ab2ce6489d1f95a5f6de6fb9492faaf97ae2060f0aa" - url: "https://pub.dev" - source: hosted - version: "2.0.1" vector_math: dependency: transitive description: diff --git a/plugins/aves_magnifier/pubspec.yaml b/plugins/aves_magnifier/pubspec.yaml index cb6f1a9c7..d51f0aa56 100644 --- a/plugins/aves_magnifier/pubspec.yaml +++ b/plugins/aves_magnifier/pubspec.yaml @@ -12,7 +12,6 @@ dependencies: path: ../aves_utils equatable: provider: - tuple: dev_dependencies: flutter_lints: diff --git a/plugins/aves_map/lib/src/zoomed_bounds.dart b/plugins/aves_map/lib/src/zoomed_bounds.dart index d0ccc1d73..a66b3c8f9 100644 --- a/plugins/aves_map/lib/src/zoomed_bounds.dart +++ b/plugins/aves_map/lib/src/zoomed_bounds.dart @@ -23,8 +23,7 @@ class ZoomedBounds extends Equatable { final swPoint = _crs.latLngToPoint(sw, zoom); final nePoint = _crs.latLngToPoint(ne, zoom); // assume no padding around bounds - final projectedCenter = _crs.pointToLatLng((swPoint + nePoint) / 2, zoom); - return projectedCenter ?? GeoUtils.getLatLngCenter([sw, ne]); + return _crs.pointToLatLng((swPoint + nePoint) / 2, zoom); } @override diff --git a/plugins/aves_map/pubspec.lock b/plugins/aves_map/pubspec.lock index a3e069de4..74fd8aa4e 100644 --- a/plugins/aves_map/pubspec.lock +++ b/plugins/aves_map/pubspec.lock @@ -81,18 +81,18 @@ packages: dependency: "direct main" description: name: flutter_map - sha256: "52c65a977daae42f9aae6748418dd1535eaf27186e9bac9bf431843082bc75a3" + sha256: "5286f72f87deb132daa1489442d6cc46e986fc105cb727d9ae1b602b35b1d1f3" url: "https://pub.dev" source: hosted - version: "4.0.0" + version: "5.0.0" http: dependency: transitive description: name: http - sha256: "5895291c13fa8a3bd82e76d5627f69e0d85ca6a30dcac95c4ea19a5d555879c2" + sha256: "4c3f04bfb64d3efd508d06b41b825542f08122d30bda4933fb95c069d22a4fa3" url: "https://pub.dev" source: hosted - version: "0.13.6" + version: "1.0.0" http_parser: dependency: transitive description: @@ -121,10 +121,10 @@ packages: dependency: "direct main" description: name: latlong2 - sha256: "08ef7282ba9f76e8495e49e2dc4d653015ac929dce5f92b375a415d30b407ea0" + sha256: "18712164760cee655bc790122b0fd8f3d5b3c36da2cb7bf94b68a197fbb0811b" url: "https://pub.dev" source: hosted - version: "0.8.2" + version: "0.9.0" lints: dependency: transitive description: @@ -234,14 +234,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.2.1" - tuple: - dependency: transitive - description: - name: tuple - sha256: "0ea99cd2f9352b2586583ab2ce6489d1f95a5f6de6fb9492faaf97ae2060f0aa" - url: "https://pub.dev" - source: hosted - version: "2.0.1" typed_data: dependency: transitive description: @@ -276,4 +268,4 @@ packages: version: "2.0.0" sdks: dart: ">=3.0.0 <4.0.0" - flutter: ">=3.3.0" + flutter: ">=3.10.0" diff --git a/plugins/aves_services/pubspec.lock b/plugins/aves_services/pubspec.lock index 2855f37c9..33f4d23e7 100644 --- a/plugins/aves_services/pubspec.lock +++ b/plugins/aves_services/pubspec.lock @@ -88,18 +88,18 @@ packages: dependency: transitive description: name: flutter_map - sha256: "52c65a977daae42f9aae6748418dd1535eaf27186e9bac9bf431843082bc75a3" + sha256: "5286f72f87deb132daa1489442d6cc46e986fc105cb727d9ae1b602b35b1d1f3" url: "https://pub.dev" source: hosted - version: "4.0.0" + version: "5.0.0" http: dependency: transitive description: name: http - sha256: "5895291c13fa8a3bd82e76d5627f69e0d85ca6a30dcac95c4ea19a5d555879c2" + sha256: "4c3f04bfb64d3efd508d06b41b825542f08122d30bda4933fb95c069d22a4fa3" url: "https://pub.dev" source: hosted - version: "0.13.6" + version: "1.0.0" http_parser: dependency: transitive description: @@ -128,10 +128,10 @@ packages: dependency: "direct main" description: name: latlong2 - sha256: "08ef7282ba9f76e8495e49e2dc4d653015ac929dce5f92b375a415d30b407ea0" + sha256: "18712164760cee655bc790122b0fd8f3d5b3c36da2cb7bf94b68a197fbb0811b" url: "https://pub.dev" source: hosted - version: "0.8.2" + version: "0.9.0" lints: dependency: transitive description: @@ -241,14 +241,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.2.1" - tuple: - dependency: transitive - description: - name: tuple - sha256: "0ea99cd2f9352b2586583ab2ce6489d1f95a5f6de6fb9492faaf97ae2060f0aa" - url: "https://pub.dev" - source: hosted - version: "2.0.1" typed_data: dependency: transitive description: @@ -283,4 +275,4 @@ packages: version: "2.0.0" sdks: dart: ">=3.0.0 <4.0.0" - flutter: ">=3.3.0" + flutter: ">=3.10.0" diff --git a/plugins/aves_services_google/pubspec.lock b/plugins/aves_services_google/pubspec.lock index 0c9a30818..455169328 100644 --- a/plugins/aves_services_google/pubspec.lock +++ b/plugins/aves_services_google/pubspec.lock @@ -127,10 +127,10 @@ packages: dependency: transitive description: name: flutter_map - sha256: "52c65a977daae42f9aae6748418dd1535eaf27186e9bac9bf431843082bc75a3" + sha256: "5286f72f87deb132daa1489442d6cc46e986fc105cb727d9ae1b602b35b1d1f3" url: "https://pub.dev" source: hosted - version: "4.0.0" + version: "5.0.0" flutter_plugin_android_lifecycle: dependency: transitive description: @@ -204,10 +204,10 @@ packages: dependency: transitive description: name: http - sha256: "5895291c13fa8a3bd82e76d5627f69e0d85ca6a30dcac95c4ea19a5d555879c2" + sha256: "4c3f04bfb64d3efd508d06b41b825542f08122d30bda4933fb95c069d22a4fa3" url: "https://pub.dev" source: hosted - version: "0.13.6" + version: "1.0.0" http_parser: dependency: transitive description: @@ -236,10 +236,10 @@ packages: dependency: "direct main" description: name: latlong2 - sha256: "08ef7282ba9f76e8495e49e2dc4d653015ac929dce5f92b375a415d30b407ea0" + sha256: "18712164760cee655bc790122b0fd8f3d5b3c36da2cb7bf94b68a197fbb0811b" url: "https://pub.dev" source: hosted - version: "0.8.2" + version: "0.9.0" lints: dependency: transitive description: @@ -365,14 +365,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.2.1" - tuple: - dependency: transitive - description: - name: tuple - sha256: "0ea99cd2f9352b2586583ab2ce6489d1f95a5f6de6fb9492faaf97ae2060f0aa" - url: "https://pub.dev" - source: hosted - version: "2.0.1" typed_data: dependency: transitive description: @@ -423,4 +415,4 @@ packages: version: "2.0.0" sdks: dart: ">=3.0.0 <4.0.0" - flutter: ">=3.3.0" + flutter: ">=3.10.0" diff --git a/plugins/aves_services_huawei/pubspec.lock b/plugins/aves_services_huawei/pubspec.lock index 4460f1bde..b4b26f4e8 100644 --- a/plugins/aves_services_huawei/pubspec.lock +++ b/plugins/aves_services_huawei/pubspec.lock @@ -102,18 +102,18 @@ packages: dependency: transitive description: name: flutter_map - sha256: "52c65a977daae42f9aae6748418dd1535eaf27186e9bac9bf431843082bc75a3" + sha256: "5286f72f87deb132daa1489442d6cc46e986fc105cb727d9ae1b602b35b1d1f3" url: "https://pub.dev" source: hosted - version: "4.0.0" + version: "5.0.0" http: dependency: transitive description: name: http - sha256: "5895291c13fa8a3bd82e76d5627f69e0d85ca6a30dcac95c4ea19a5d555879c2" + sha256: "4c3f04bfb64d3efd508d06b41b825542f08122d30bda4933fb95c069d22a4fa3" url: "https://pub.dev" source: hosted - version: "0.13.6" + version: "1.0.0" http_parser: dependency: transitive description: @@ -160,10 +160,10 @@ packages: dependency: "direct main" description: name: latlong2 - sha256: "08ef7282ba9f76e8495e49e2dc4d653015ac929dce5f92b375a415d30b407ea0" + sha256: "18712164760cee655bc790122b0fd8f3d5b3c36da2cb7bf94b68a197fbb0811b" url: "https://pub.dev" source: hosted - version: "0.8.2" + version: "0.9.0" lints: dependency: transitive description: @@ -281,14 +281,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.2.1" - tuple: - dependency: transitive - description: - name: tuple - sha256: "0ea99cd2f9352b2586583ab2ce6489d1f95a5f6de6fb9492faaf97ae2060f0aa" - url: "https://pub.dev" - source: hosted - version: "2.0.1" typed_data: dependency: transitive description: @@ -323,4 +315,4 @@ packages: version: "2.0.0" sdks: dart: ">=3.0.0 <4.0.0" - flutter: ">=3.3.0" + flutter: ">=3.10.0" diff --git a/plugins/aves_services_none/pubspec.lock b/plugins/aves_services_none/pubspec.lock index c5c70e4c5..ece40bb07 100644 --- a/plugins/aves_services_none/pubspec.lock +++ b/plugins/aves_services_none/pubspec.lock @@ -95,18 +95,18 @@ packages: dependency: transitive description: name: flutter_map - sha256: "52c65a977daae42f9aae6748418dd1535eaf27186e9bac9bf431843082bc75a3" + sha256: "5286f72f87deb132daa1489442d6cc46e986fc105cb727d9ae1b602b35b1d1f3" url: "https://pub.dev" source: hosted - version: "4.0.0" + version: "5.0.0" http: dependency: transitive description: name: http - sha256: "5895291c13fa8a3bd82e76d5627f69e0d85ca6a30dcac95c4ea19a5d555879c2" + sha256: "4c3f04bfb64d3efd508d06b41b825542f08122d30bda4933fb95c069d22a4fa3" url: "https://pub.dev" source: hosted - version: "0.13.6" + version: "1.0.0" http_parser: dependency: transitive description: @@ -135,10 +135,10 @@ packages: dependency: "direct main" description: name: latlong2 - sha256: "08ef7282ba9f76e8495e49e2dc4d653015ac929dce5f92b375a415d30b407ea0" + sha256: "18712164760cee655bc790122b0fd8f3d5b3c36da2cb7bf94b68a197fbb0811b" url: "https://pub.dev" source: hosted - version: "0.8.2" + version: "0.9.0" lints: dependency: transitive description: @@ -248,14 +248,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.2.1" - tuple: - dependency: transitive - description: - name: tuple - sha256: "0ea99cd2f9352b2586583ab2ce6489d1f95a5f6de6fb9492faaf97ae2060f0aa" - url: "https://pub.dev" - source: hosted - version: "2.0.1" typed_data: dependency: transitive description: @@ -290,4 +282,4 @@ packages: version: "2.0.0" sdks: dart: ">=3.0.0 <4.0.0" - flutter: ">=3.3.0" + flutter: ">=3.10.0" diff --git a/pubspec.lock b/pubspec.lock index b541bac71..54c1bb117 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -479,10 +479,10 @@ packages: dependency: "direct main" description: name: flutter_map - sha256: "52c65a977daae42f9aae6748418dd1535eaf27186e9bac9bf431843082bc75a3" + sha256: "5286f72f87deb132daa1489442d6cc46e986fc105cb727d9ae1b602b35b1d1f3" url: "https://pub.dev" source: hosted - version: "4.0.0" + version: "5.0.0" flutter_markdown: dependency: "direct main" description: @@ -614,10 +614,10 @@ packages: dependency: transitive description: name: http - sha256: "5895291c13fa8a3bd82e76d5627f69e0d85ca6a30dcac95c4ea19a5d555879c2" + sha256: "4c3f04bfb64d3efd508d06b41b825542f08122d30bda4933fb95c069d22a4fa3" url: "https://pub.dev" source: hosted - version: "0.13.6" + version: "1.0.0" http_multi_server: dependency: transitive description: @@ -670,10 +670,10 @@ packages: dependency: "direct main" description: name: latlong2 - sha256: "08ef7282ba9f76e8495e49e2dc4d653015ac929dce5f92b375a415d30b407ea0" + sha256: "18712164760cee655bc790122b0fd8f3d5b3c36da2cb7bf94b68a197fbb0811b" url: "https://pub.dev" source: hosted - version: "0.8.2" + version: "0.9.0" lints: dependency: transitive description: diff --git a/test/model/collection_source_test.dart b/test/model/collection_source_test.dart index a8249b240..7a0dee3bd 100644 --- a/test/model/collection_source_test.dart +++ b/test/model/collection_source_test.dart @@ -46,7 +46,7 @@ void main() { const destinationAlbum = '${FakeStorageService.primaryPath}Pictures/destination'; const aTag = 'sometag'; - final australiaLatLng = LatLng(-26, 141); + const australiaLatLng = LatLng(-26, 141); const australiaAddress = AddressDetails( id: 0, countryCode: 'AU', diff --git a/test/model/filters_test.dart b/test/model/filters_test.dart index fe50208fe..44781b96c 100644 --- a/test/model/filters_test.dart +++ b/test/model/filters_test.dart @@ -41,7 +41,7 @@ void main() { final aspectRatio = AspectRatioFilter.landscape; expect(aspectRatio, jsonRoundTrip(aspectRatio)); - final bounds = CoordinateFilter(LatLng(29.979167, 28.223615), LatLng(36.451000, 31.134167)); + final bounds = CoordinateFilter(const LatLng(29.979167, 28.223615), const LatLng(36.451000, 31.134167)); expect(bounds, jsonRoundTrip(bounds)); final date = DateFilter(DateLevel.ym, DateTime(1969, 7)); diff --git a/test/utils/geo_utils_test.dart b/test/utils/geo_utils_test.dart index 8fe3fef49..11f862a32 100644 --- a/test/utils/geo_utils_test.dart +++ b/test/utils/geo_utils_test.dart @@ -8,18 +8,18 @@ import 'package:test/test.dart'; void main() { test('Decimal degrees to DMS (sexagesimal)', () { final l10n = lookupAppLocalizations(AvesApp.supportedLocales.first); - expect(ExtraCoordinateFormat.toDMS(l10n, LatLng(37.496667, 127.0275)), ['37° 29′ 48.00″ N', '127° 1′ 39.00″ E']); // Gangnam - expect(ExtraCoordinateFormat.toDMS(l10n, LatLng(78.9243503, 11.9230465)), ['78° 55′ 27.66″ N', '11° 55′ 22.97″ E']); // Ny-Ålesund - expect(ExtraCoordinateFormat.toDMS(l10n, LatLng(-38.6965891, 175.9830047)), ['38° 41′ 47.72″ S', '175° 58′ 58.82″ E']); // Taupo - expect(ExtraCoordinateFormat.toDMS(l10n, LatLng(-64.249391, -56.6556145)), ['64° 14′ 57.81″ S', '56° 39′ 20.21″ W']); // Marambio - expect(ExtraCoordinateFormat.toDMS(l10n, LatLng(0, 0)), ['0° 0′ 0.00″ N', '0° 0′ 0.00″ E']); - expect(ExtraCoordinateFormat.toDMS(l10n, LatLng(0, 0), minuteSecondPadding: true), ['0° 00′ 00.00″ N', '0° 00′ 00.00″ E']); - expect(ExtraCoordinateFormat.toDMS(l10n, LatLng(0, 0), secondDecimals: 0), ['0° 0′ 0″ N', '0° 0′ 0″ E']); - expect(ExtraCoordinateFormat.toDMS(l10n, LatLng(0, 0), secondDecimals: 4), ['0° 0′ 0.0000″ N', '0° 0′ 0.0000″ E']); + expect(ExtraCoordinateFormat.toDMS(l10n, const LatLng(37.496667, 127.0275)), ['37° 29′ 48.00″ N', '127° 1′ 39.00″ E']); // Gangnam + expect(ExtraCoordinateFormat.toDMS(l10n, const LatLng(78.9243503, 11.9230465)), ['78° 55′ 27.66″ N', '11° 55′ 22.97″ E']); // Ny-Ålesund + expect(ExtraCoordinateFormat.toDMS(l10n, const LatLng(-38.6965891, 175.9830047)), ['38° 41′ 47.72″ S', '175° 58′ 58.82″ E']); // Taupo + expect(ExtraCoordinateFormat.toDMS(l10n, const LatLng(-64.249391, -56.6556145)), ['64° 14′ 57.81″ S', '56° 39′ 20.21″ W']); // Marambio + expect(ExtraCoordinateFormat.toDMS(l10n, const LatLng(0, 0)), ['0° 0′ 0.00″ N', '0° 0′ 0.00″ E']); + expect(ExtraCoordinateFormat.toDMS(l10n, const LatLng(0, 0), minuteSecondPadding: true), ['0° 00′ 00.00″ N', '0° 00′ 00.00″ E']); + expect(ExtraCoordinateFormat.toDMS(l10n, const LatLng(0, 0), secondDecimals: 0), ['0° 0′ 0″ N', '0° 0′ 0″ E']); + expect(ExtraCoordinateFormat.toDMS(l10n, const LatLng(0, 0), secondDecimals: 4), ['0° 0′ 0.0000″ N', '0° 0′ 0.0000″ E']); }); test('bounds center', () { - expect(GeoUtils.getLatLngCenter([LatLng(10, 30), LatLng(30, 50)]), LatLng(20.28236664671092, 39.351653000319956)); - expect(GeoUtils.getLatLngCenter([LatLng(10, -179), LatLng(30, 179)]), LatLng(20.00279344048298, -179.9358157370226)); + expect(GeoUtils.getLatLngCenter(const [LatLng(10, 30), LatLng(30, 50)]), const LatLng(20.28236664671092, 39.351653000319956)); + expect(GeoUtils.getLatLngCenter(const [LatLng(10, -179), LatLng(30, 179)]), const LatLng(20.00279344048298, -179.9358157370226)); }); }