Show distance to home as a fourth field in the fly-mode details pill

Adds computeDistanceToHomeM() (mission_stats.dart) alongside the
existing rubber-band-target helper, wired through MissionFooterBar ->
BottomStatsBar the same way flyMissionStatus already is. Only appears
once a home point is known, as the last field after waypoint/distance/
duration.

Generalized HomePointIcon to take an optional strokeColor: the map
marker keeps its dark-fill-plus-white-outline look, while the details
pill uses a plain white fill (strokeColor: null) to match the existing
monochrome flag/ruler/clock icons instead of looking like a dropped-in
map pin.
This commit is contained in:
Constantin Leue
2026-08-09 21:49:03 +02:00
parent afc380cabc
commit 6b7977eca1
6 changed files with 133 additions and 25 deletions
+25
View File
@@ -187,4 +187,29 @@ void main() {
);
});
});
group('computeDistanceToHomeM', () {
test('berechnet die Distanz aus Grosskreis', () {
final distance = computeDistanceToHomeM(
currentPosition: const LatLng(0, 0),
homePoint: const LatLng(0, 0.01),
);
// 0.01 Grad Laengendifferenz am Aequator entspricht rund 1112 m.
expect(distance, closeTo(1112.6, 1));
});
test('null ohne aktuelle Position (kein GPS-Fix)', () {
expect(
computeDistanceToHomeM(currentPosition: null, homePoint: const LatLng(0, 0)),
isNull,
);
});
test('null ohne bekannten Homepoint', () {
expect(
computeDistanceToHomeM(currentPosition: const LatLng(0, 0), homePoint: null),
isNull,
);
});
});
}