Show climb/sink rate under the altitude readout on the fly-mode map

Uses an up/down arrow instead of a +/- sign so the direction reads at
a glance, with the magnitude alongside it.
This commit is contained in:
Constantin Leue
2026-08-07 21:43:59 +02:00
parent ffad444e50
commit 893429c548
+53 -1
View File
@@ -371,7 +371,20 @@ class _FlyScreenState extends ConsumerState<FlyScreen> {
top: 56, top: 56,
bottom: footerBottomInset, bottom: footerBottomInset,
left: 14 + safeEdgeInset, left: 14 + safeEdgeInset,
child: Center(child: _liveReadout('Alt', telemetry?.altitudeM, 'm')), child: Center(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
_liveReadout('Alt', telemetry?.altitudeM, 'm'),
const SizedBox(height: 6),
// Steig-/Sinkrate direkt unter der Hoehenanzeige (Nutzerwunsch)
// - Pfeil statt Vorzeichen (+/-), da ein Pfeil auf einen Blick
// erfassbar ist, waehrend "+"/"-" bei kleiner Schrift leicht
// uebersehen wird.
_verticalSpeedReadout(telemetry?.verticalSpeedMs),
],
),
),
), ),
Positioned( Positioned(
top: 56, top: 56,
@@ -408,6 +421,45 @@ class _FlyScreenState extends ConsumerState<FlyScreen> {
); );
} }
/// Steig-/Sinkrate unter der Hoehenanzeige (siehe _liveReadout-Aufrufer
/// oben) - zeigt bewusst einen Pfeil statt eines Vorzeichens vor der Zahl
/// (Nutzerwunsch), der Betrag bleibt trotzdem als Wert sichtbar. >= 0 gilt
/// als Steigen, analog zur Vorzeichen-Konvention in
/// drone_status_messages_panel.dart._formatVerticalSpeed.
Widget _verticalSpeedReadout(double? valueMs) {
final Widget content;
if (valueMs == null) {
content = const Text(
'—',
style: TextStyle(color: Colors.white, fontSize: 15, fontWeight: FontWeight.w500),
);
} else {
content = Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(
valueMs < 0 ? Icons.arrow_downward : Icons.arrow_upward,
color: Colors.white,
size: 15,
),
const SizedBox(width: 4),
Text(
'${valueMs.abs().toStringAsFixed(1)} m/s',
style: const TextStyle(color: Colors.white, fontSize: 15, fontWeight: FontWeight.w500),
),
],
);
}
return Container(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
decoration: BoxDecoration(
color: Colors.black.withValues(alpha: 0.7),
borderRadius: BorderRadius.circular(6),
),
child: content,
);
}
Widget _liveReadout(String label, double? value, String unit) { Widget _liveReadout(String label, double? value, String unit) {
return Container( return Container(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4), padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),