mirror of
https://github.com/twonlyapp/twonly-app.git
synced 2026-09-01 06:24:07 +00:00
fix black screen issue
This commit is contained in:
parent
64c7595b6a
commit
79d668e004
2 changed files with 23 additions and 0 deletions
|
|
@ -210,6 +210,10 @@ Future<bool> authenticateUser(
|
|||
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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -671,6 +671,25 @@ class _MediaViewerViewState extends State<MediaViewerView> {
|
|||
child: Stack(
|
||||
fit: StackFit.expand,
|
||||
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 ((currentMedia != null || videoController != null) &&
|
||||
(canBeSeenUntil == null || progress.value >= 0))
|
||||
|
|
|
|||
Loading…
Reference in a new issue