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:
@@ -301,16 +301,21 @@ class _FlyScreenState extends ConsumerState<FlyScreen> {
|
||||
// Home der Homepoint) kommt aus computeRubberBandTarget, siehe dortige
|
||||
// Doku fuer den RTH-Sonderfall.
|
||||
final activeWpIndex = telemetry?.activeWaypointIndex;
|
||||
final homePointLatLng =
|
||||
homePoint == null ? null : LatLng(homePoint.lat, homePoint.lon);
|
||||
final currentPosition = telemetry != null && telemetry.hasFix
|
||||
? LatLng(telemetry.lat, telemetry.lon)
|
||||
: null;
|
||||
List<LatLng>? rubberBand;
|
||||
if (telemetry != null && telemetry.hasFix) {
|
||||
if (currentPosition != null && telemetry != null) {
|
||||
final target = computeRubberBandTarget(
|
||||
navMode: telemetry.navMode,
|
||||
activeWaypointIndex: activeWpIndex,
|
||||
waypoints: waypoints,
|
||||
homePoint: homePoint == null ? null : LatLng(homePoint.lat, homePoint.lon),
|
||||
homePoint: homePointLatLng,
|
||||
);
|
||||
if (target != null) {
|
||||
rubberBand = [LatLng(telemetry.lat, telemetry.lon), target];
|
||||
rubberBand = [currentPosition, target];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -322,11 +327,19 @@ class _FlyScreenState extends ConsumerState<FlyScreen> {
|
||||
final flyMissionStatus = computeFlyMissionStatus(
|
||||
waypoints: waypoints,
|
||||
activeWaypointIndex: activeWpIndex,
|
||||
currentLat: telemetry != null && telemetry.hasFix ? telemetry.lat : null,
|
||||
currentLon: telemetry != null && telemetry.hasFix ? telemetry.lon : null,
|
||||
currentLat: currentPosition?.latitude,
|
||||
currentLon: currentPosition?.longitude,
|
||||
currentSpeedMs: telemetry?.speedMs,
|
||||
);
|
||||
|
||||
// Entfernung zum Homepoint als letztes Element der Details-Pille (Doku:
|
||||
// "zeige die Entfernung zum Home Punkt als letztes element in der
|
||||
// details pille im fly modus an").
|
||||
final distanceToHomeM = computeDistanceToHomeM(
|
||||
currentPosition: currentPosition,
|
||||
homePoint: homePointLatLng,
|
||||
);
|
||||
|
||||
// Drohnen-Status fuer die Drohnen-Pille (Doku: "im fly modus zeigt die
|
||||
// drone pille den zustand der drohne") - das Aussehen des Fly-Modus darf
|
||||
// nicht am Vorhandensein eines Telemetrie-Frames haengen (sonst faellt
|
||||
@@ -430,6 +443,7 @@ class _FlyScreenState extends ConsumerState<FlyScreen> {
|
||||
totalDistanceM: missionStats.distanceM,
|
||||
totalDurationSec: missionStats.durationSec,
|
||||
flyMissionStatus: flyMissionStatus,
|
||||
distanceToHomeM: distanceToHomeM,
|
||||
droneStatus: droneStatus,
|
||||
warnings: warnings,
|
||||
showWarningsBanner: false,
|
||||
|
||||
Reference in New Issue
Block a user