Auto-fetch wind, drop manual fetch/validate buttons, fix it in fly mode
Redesigns the waypoint list panel to match the drone-status/missions panels: no title bar, close button floats over the tab row, tabs get more vertical padding. Removes the "Fetch wind" and "Validate" header buttons along with the now-fully-orphaned WindValidatePanel screen and its WindService support code (fetchValidation, WindValidationResult and friends) - nothing else referenced them. Wind is now fetched automatically instead: HeaderWindNotifier gains ensurePerWaypointWind(), called when the waypoint list panel opens and when the header pill's per-waypoint toggle switches on. A lat/lon signature of the waypoint list tracks whether the fetched data is still current, so a ref.listen(currentMissionProvider) in the same notifier refetches only when the list itself changes (position added/ removed/moved) - not on every altitude/speed edit. Waypoints that already carry wind data (e.g. loaded from a saved mission) short- circuit the check instead of re-fetching pointlessly. Also wires per-waypoint wind markers into the fly-mode map, which never had them (plan_screen.dart built windMarkers; fly_screen.dart just never did) - the reported "doesn't work in fly mode" bug. windMarkerWidth() moved from a plan_screen.dart-private method to wind_marker_pill.dart so both screens can share it. Test containers in widget_test.dart now override windServiceProvider with a MockClient so the new auto-fetch trigger can't reach the real network during tests.
This commit is contained in:
@@ -432,7 +432,7 @@ class _PlanScreenState extends ConsumerState<PlanScreen> {
|
||||
if (wp.windSpeedMs != null && wp.windDirFromDeg != null)
|
||||
Marker(
|
||||
point: LatLng(wp.lat, wp.lon),
|
||||
width: _windMarkerWidth(wp.windSpeedMs!),
|
||||
width: windMarkerWidth(wp.windSpeedMs!),
|
||||
height: 22,
|
||||
alignment: const Alignment(1.1, -1.5),
|
||||
child: WindMarkerPill(
|
||||
@@ -556,19 +556,4 @@ class _PlanScreenState extends ConsumerState<PlanScreen> {
|
||||
borderColor: Colors.white,
|
||||
);
|
||||
}
|
||||
|
||||
/// flutter_map's Marker verlangt eine feste Breite (kein intrinsisches
|
||||
/// Sizing wie bei normalen Widgets) - eine einzelne fuer alle Faelle
|
||||
/// grosszuegig bemessene Breite liesse bei kurzen Werten (z.B. "1 m/s")
|
||||
/// sichtbaren Leerraum rechts neben dem Text. Stattdessen je Ziffernzahl
|
||||
/// berechnet (per Widget-Messung ermittelt: +11px/Ziffer, siehe
|
||||
/// WindMarkerPill).
|
||||
double _windMarkerWidth(double speedMs) {
|
||||
final digits = speedMs.round().abs().toString().length;
|
||||
// +1px Puffer: MarkerLayer rendert ueber eine eigene Transform-/
|
||||
// OverflowBox-Kette, die im echten Baum minimal (< 1px) anders rundet
|
||||
// als eine isolierte Messung - ohne Puffer fuehrte das zu einem
|
||||
// 0.25px-Overflow.
|
||||
return 81.0 + digits * 11.0;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user