Add top bar for switching between Plan and Fly mode

- TopModeBar widget: persistent pill-shaped header (HTML prototype:
  #topBarWrap/#editModeBtn/#flyModeBtn) tinted in the active mode's color,
  with the inactive mode offered as a solid button in the corner to switch
  into it.
- AppShell now provides a single shared Scaffold + Stack, overlaying
  TopModeBar on top of whichever screen (Plan/Fly) is active, instead of
  each screen owning its own Scaffold.
- Wired the Fly button to AppModeCubit.toFly(), which enforces the
  Ready-to-Fly gate (doc 4.5). Since upload/verify isn't wired up yet, the
  gate is never satisfied yet, so tapping Fly now shows a SnackBar instead
  of throwing an uncaught StateError.
- Extended the widget test to cover both the bar's presence and the
  gate-rejection path (was the source of a real bug: an initial
  negative-margin Container hack for the "bleed into the corner" look
  violated Container's margin.isNonNegative assertion and crashed the
  whole tree - fixed with padding instead).

Verified with flutter analyze, flutter test, and a real run on the
Pixel_10a emulator (visually matches the prototype screenshots in design/,
Fly-tap correctly shows the gate message without crashing or switching mode).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Constantin Leue
2026-07-27 07:40:40 +02:00
co-authored by Claude Sonnet 5
parent 02dd1bc11a
commit fc7d014fda
5 changed files with 169 additions and 22 deletions
+7 -3
View File
@@ -2,14 +2,18 @@ import 'package:flutter/material.dart';
/// Fly-Modus: Telemetrie, Draeder, Point-and-Fly-Fadenkreuz
/// (Architektur-Doku 3.10/3.11). Platzhalter bis Telemetry-Service und
/// FlightControllerLink verdrahtet sind.
/// FlightControllerLink verdrahtet sind. Kein eigenes Scaffold, siehe
/// PlanScreen/AppShell.
class FlyScreen extends StatelessWidget {
const FlyScreen({super.key});
@override
Widget build(BuildContext context) {
return const Scaffold(
body: Center(child: Text('Fly')),
return const ColoredBox(
color: Color(0xFF0F0F0F),
child: Center(
child: Text('Fly', style: TextStyle(color: Colors.white)),
),
);
}
}