connection settings cleanup and mock test added. removed bluetooth implementation

This commit is contained in:
Constantin Leue
2026-08-05 20:01:25 +02:00
parent 8e4df2d0d3
commit f65dceb338
15 changed files with 113 additions and 895 deletions
+46 -3
View File
@@ -26,8 +26,12 @@ import '../dmc_colors.dart';
class BatteryIndicatorBar extends StatelessWidget {
const BatteryIndicatorBar({super.key, required this.percent});
/// 0-100, ungeklemmter Rohwert aus TelemetryFrame.batteryPercent.
final int percent;
/// 0-100, ungeklemmter Rohwert aus TelemetryFrame.batteryPercent - null,
/// solange noch kein Telemetrie-Frame vorliegt (Verbindungsaufbau laeuft
/// noch). Rendert dann einen neutralen "keine Daten"-Zustand statt eines
/// Balkens bei 0%, das faelschlich als kritischer Ladestand gelesen werden
/// koennte (siehe MissionFooterBar.showBattery).
final int? percent;
/// Absolute Positionen (vom linken Rand aus), an denen rot in orange und
/// orange in gruen uebergeht - siehe Klassendoku.
@@ -51,7 +55,46 @@ class BatteryIndicatorBar extends StatelessWidget {
@override
Widget build(BuildContext context) {
final clampedPercent = percent.clamp(0, 100);
final rawPercent = percent;
if (rawPercent == null) {
return SizedBox(
height: _pillHeight,
width: double.infinity,
child: Stack(
clipBehavior: Clip.none,
children: [
Positioned(
left: 0,
right: 0,
top: (_pillHeight - _barHeight) / 2,
height: _barHeight,
child: ColoredBox(color: Colors.white.withValues(alpha: _trackAlpha)),
),
Center(
child: Container(
height: _pillHeight,
constraints: const BoxConstraints(minWidth: _pillMinWidth),
padding: const EdgeInsets.symmetric(horizontal: 6),
alignment: Alignment.center,
decoration: BoxDecoration(
color: Colors.black.withValues(alpha: _pillNeutralAlpha),
borderRadius: BorderRadius.circular(_pillHeight / 2),
),
child: const Text(
'--%',
style: TextStyle(
color: Colors.white70,
fontSize: 11,
fontWeight: FontWeight.w600,
),
),
),
),
],
),
);
}
final clampedPercent = rawPercent.clamp(0, 100);
return SizedBox(
height: _pillHeight,
+13 -5
View File
@@ -48,7 +48,11 @@ class MissionFooterBar extends ConsumerWidget {
final FlyMissionStatus? flyMissionStatus;
/// Nur im Fly-Modus gesetzt (Doku: "im fly modus zeigt die drone pille
/// den zustand der drohne") - siehe BottomStatsBar.droneStatus.
/// den zustand der drohne") - siehe BottomStatsBar.droneStatus. FlyScreen
/// setzt hier immer einen Wert (auch ohne Telemetrie-Frame, siehe dortige
/// Doku), Plan-Modus nie - dient deshalb hier zugleich als Fly/Plan-
/// Unterscheidung fuer die Sichtbarkeit von [batteryPercent], statt dafuer
/// ein eigenes Flag zu fuehren.
final DroneStatus? droneStatus;
final List<MissionWarning> warnings;
@@ -61,8 +65,12 @@ class MissionFooterBar extends ConsumerWidget {
/// Nur im Fly-Modus gesetzt (Doku: "Batterieanzeige im Fly-Modus
/// hinzufuegen") - zeigt den Batteriebalken ueber der BottomStatsBar an,
/// unter einem ggf. ausgeklappten Hoehenprofil. Bleibt im Plan-Modus null
/// (keine Telemetrie), die Anzeige entfaellt dann vollstaendig.
/// unter einem ggf. ausgeklappten Hoehenprofil. Sichtbarkeit haengt an
/// [droneStatus] statt an diesem Wert selbst (siehe dort) - im Fly-Modus
/// bleibt der Balken deshalb auch ohne Telemetrie-Frame sichtbar, nur der
/// Prozentwert ist dann null (BatteryIndicatorBar zeigt dafuer einen
/// neutralen "keine Daten"-Zustand statt 0%, das faelschlich als
/// kritischer Ladestand gelesen werden koennte).
final int? batteryPercent;
/// Siehe BottomStatsBar.forceShowWarningsButton.
@@ -105,10 +113,10 @@ class MissionFooterBar extends ConsumerWidget {
activeIndex: activeIndex,
),
),
if (batteryPercent != null)
if (droneStatus != null)
Padding(
padding: const EdgeInsets.fromLTRB(0, 4, 0, 0),
child: BatteryIndicatorBar(percent: batteryPercent!),
child: BatteryIndicatorBar(percent: batteryPercent),
),
BottomStatsBar(
waypointCount: waypoints.length,