fix black screen issue

This commit is contained in:
otsmr 2026-07-29 14:22:22 +02:00
parent 64c7595b6a
commit 79d668e004
2 changed files with 23 additions and 0 deletions

View file

@ -210,6 +210,10 @@ Future<bool> authenticateUser(
return true; return true;
} }
} }
} catch (e) {
// Catch unexpected platform exceptions (e.g. PlatformException) that
// would otherwise propagate and leave callers in a broken state.
Log.error('Unexpected authentication error: $e');
} }
return false; return false;
} }

View file

@ -671,6 +671,25 @@ class _MediaViewerViewState extends State<MediaViewerView> {
child: Stack( child: Stack(
fit: StackFit.expand, fit: StackFit.expand,
children: [ children: [
// Fallback: when no content is visible (no media, no loader,
// no twonly-present overlay), show a loader to prevent a
// black screen. If there are truly no files left, exit.
if (!_showDownloadingLoader &&
currentMedia == null &&
videoController == null &&
!displayTwonlyPresent)
Builder(builder: (context) {
// Schedule exit on the next frame if there is nothing
// left to display, so we don't trap the user.
if (allMediaFiles.isEmpty) {
WidgetsBinding.instance.addPostFrameCallback((_) {
if (mounted && currentMedia == null) {
Navigator.of(context).maybePop();
}
});
}
return _loader();
}),
if (_showDownloadingLoader) _loader(), if (_showDownloadingLoader) _loader(),
if ((currentMedia != null || videoController != null) && if ((currentMedia != null || videoController != null) &&
(canBeSeenUntil == null || progress.value >= 0)) (canBeSeenUntil == null || progress.value >= 0))