fix: System bars contiuously showing on Android video player (#568)

Co-authored-by: PartyDonut <PartyDonut@users.noreply.github.com>
This commit is contained in:
vikingnope 2025-11-07 10:10:17 +01:00 committed by GitHub
parent 861d75b1e9
commit b9c1e82b43
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 17 additions and 10 deletions

View file

@ -60,6 +60,7 @@ class _DesktopControlsState extends ConsumerState<DesktopControls> {
final fadeDuration = const Duration(milliseconds: 350);
bool showOverlay = true;
bool wasPlaying = false;
SystemUiMode? _currentSystemUiMode;
late final double topPadding = MediaQuery.of(context).viewPadding.top;
late final double bottomPadding = MediaQuery.of(context).viewPadding.bottom;
@ -625,7 +626,14 @@ class _DesktopControlsState extends ConsumerState<DesktopControls> {
if (showOverlay == (value ?? !showOverlay)) return;
setState(() => showOverlay = (value ?? !showOverlay));
resetTimer();
SystemChrome.setEnabledSystemUIMode(showOverlay ? SystemUiMode.edgeToEdge : SystemUiMode.leanBack, overlays: []);
final desiredMode = showOverlay ? SystemUiMode.edgeToEdge : SystemUiMode.immersiveSticky;
if (_currentSystemUiMode != desiredMode) {
_currentSystemUiMode = desiredMode;
SystemChrome.setEnabledSystemUIMode(desiredMode, overlays: []);
}
SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(
statusBarColor: Colors.transparent,
systemNavigationBarColor: Colors.transparent,