package upgrade

This commit is contained in:
Thibault Deckers 2023-06-04 23:26:41 +02:00
parent a60efa67ad
commit e2400a09a6
16 changed files with 68 additions and 121 deletions

View file

@ -82,7 +82,7 @@ extension ExtraAvesEntryMetadataEdition on AvesEntry {
return dataTypes;
}
static final removalLocation = LatLng(0, 0);
static const removalLocation = LatLng(0, 0);
Future<Set<EntryDataType>> editLocation(LatLng? latLng) async {
final dataTypes = <EntryDataType>{};

View file

@ -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),

View file

@ -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,

View file

@ -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<AvesMagnifier> 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<AvesMagnifier> 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<AvesMagnifier> 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<AvesMagnifier> 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<AvesMagnifier> 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,
);
}

View file

@ -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:

View file

@ -12,7 +12,6 @@ dependencies:
path: ../aves_utils
equatable:
provider:
tuple:
dev_dependencies:
flutter_lints:

View file

@ -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

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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:

View file

@ -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',

View file

@ -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));

View file

@ -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));
});
}