diff --git a/app/lib/ui/app_shell.dart b/app/lib/ui/app_shell.dart index 63fa3ca..c216127 100644 --- a/app/lib/ui/app_shell.dart +++ b/app/lib/ui/app_shell.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:wakelock_plus/wakelock_plus.dart'; import '../app_mode/app_mode_cubit.dart'; import 'screens/fly/fly_screen.dart'; @@ -18,12 +19,26 @@ class AppShell extends StatelessWidget { final mode = context.select((AppModeCubit c) => c.state.mode); final screen = mode == AppMode.fly ? const FlyScreen() : const PlanScreen(); - return Scaffold( - body: Stack( - children: [ - Positioned.fill(child: screen), - const Align(alignment: Alignment.topCenter, child: TopModeBar()), - ], + return BlocListener( + listenWhen: (previous, current) => previous.mode != current.mode, + listener: (context, state) { + // Nur FLAG_KEEP_SCREEN_ON, kein PowerManager.WakeLock (Doku 4.20 + // deckt den Foreground-Service fuer Hintergrund-Telemetrie separat + // ab). Android-Empfehlung: an die Activity-Sichtbarkeit gebunden, + // keine Permission, kein manuelles Leak-Risiko. + if (state.mode == AppMode.fly) { + WakelockPlus.enable(); + } else { + WakelockPlus.disable(); + } + }, + child: Scaffold( + body: Stack( + children: [ + Positioned.fill(child: screen), + const Align(alignment: Alignment.topCenter, child: TopModeBar()), + ], + ), ), ); } diff --git a/app/pubspec.lock b/app/pubspec.lock index e7fb8f0..c63784b 100644 --- a/app/pubspec.lock +++ b/app/pubspec.lock @@ -632,6 +632,22 @@ packages: url: "https://pub.dev" source: hosted version: "2.2.0" + package_info_plus: + dependency: transitive + description: + name: package_info_plus + sha256: "127e1751e37ffb2ff4658beeaca77bad0c27bf5f932bd3a501c2296926d4b481" + url: "https://pub.dev" + source: hosted + version: "10.2.1" + package_info_plus_platform_interface: + dependency: transitive + description: + name: package_info_plus_platform_interface + sha256: db762cb2f4f25ee60fb6359773861b0f199e00b90d237bd85a76a1e806b46ef4 + url: "https://pub.dev" + source: hosted + version: "4.1.0" path: dependency: "direct main" description: @@ -1125,6 +1141,22 @@ packages: url: "https://pub.dev" source: hosted version: "15.2.0" + wakelock_plus: + dependency: "direct main" + description: + name: wakelock_plus + sha256: "7253bca0fcf40d8413ddfcf4d2a1fa0a82475e79be25a4f2c564b695c9351486" + url: "https://pub.dev" + source: hosted + version: "1.7.0" + wakelock_plus_platform_interface: + dependency: transitive + description: + name: wakelock_plus_platform_interface + sha256: "0618d1799f0b28bcf98255b4ee8313e6fc4d38589dc4ee5fe5840d57d1aff6da" + url: "https://pub.dev" + source: hosted + version: "1.6.0" watcher: dependency: transitive description: diff --git a/app/pubspec.yaml b/app/pubspec.yaml index cb62789..274c92b 100644 --- a/app/pubspec.yaml +++ b/app/pubspec.yaml @@ -58,6 +58,7 @@ dependencies: flutter_classic_bluetooth: ^0.1.6 permission_handler: ^12.0.3 app_settings: ^8.0.3 + wakelock_plus: ^1.7.0 dev_dependencies: flutter_test: diff --git a/design/.~lock.DMC logo sketches.odp# b/design/.~lock.DMC logo sketches.odp# new file mode 100644 index 0000000..af6e94b --- /dev/null +++ b/design/.~lock.DMC logo sketches.odp# @@ -0,0 +1 @@ +,AI/Consti,AI,03.08.2026 21:25,file:///C:/Users/Consti/AppData/Roaming/LibreOffice/4; \ No newline at end of file diff --git a/design/DMC logo sketches.odp b/design/DMC logo sketches.odp index 028b31b..4738c77 100644 Binary files a/design/DMC logo sketches.odp and b/design/DMC logo sketches.odp differ