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:
@@ -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,
|
||||
);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user