implemented post-login splash screen with Lottie animations and integrated background data prefetching during the login transition

This commit is contained in:
2026-06-29 12:00:26 +02:00
parent 13f4f79829
commit 4bc7ffd37a
6 changed files with 256 additions and 40 deletions
+29 -1
View File
@@ -41,6 +41,7 @@ import 'theming/dark_app_theme.dart';
import 'theming/light_app_theme.dart';
import 'utils/app_paths.dart';
import 'view/login/login.dart';
import 'view/login/post_login_splash.dart';
import 'widget/app_progress_indicator.dart';
import 'widget/breaker/breaker.dart';
import 'widget/debug/cache_view.dart';
@@ -188,6 +189,9 @@ class Main extends StatefulWidget {
}
class _MainState extends State<Main> {
bool _showPostLoginSplash = false;
bool _appMounted = true;
@override
void initState() {
super.initState();
@@ -215,6 +219,12 @@ class _MainState extends State<Main> {
/// password has been rotated server-side; the validator wipes the local
/// session and we flip the account bloc back to `loggedOut`, which sends
/// the user to the login screen.
void _prefetchBaseData(BuildContext context) {
context.read<TimetableBloc>().refresh();
unawaited(context.read<ChatListBloc>().refresh(silent: true));
unawaited(ListFilesCache.prefetchRootListing());
}
void _scheduleSessionValidation(AccountBloc accountBloc) {
unawaited(
SessionValidator.probeStored(
@@ -282,6 +292,12 @@ class _MainState extends State<Main> {
unawaited(
context.read<NextcloudCapabilitiesCubit>().load(),
);
_showPostLoginSplash = true;
_appMounted = false;
WidgetsBinding.instance.addPostFrameCallback((_) {
if (mounted) setState(() => _appMounted = true);
});
_prefetchBaseData(context);
}
if (accountState.status != AccountStatus.loggedOut) return;
// A pending share would otherwise survive logout and be
@@ -328,7 +344,19 @@ class _MainState extends State<Main> {
builder: (context, accountState) {
switch (accountState.status) {
case AccountStatus.loggedIn:
return const App();
return Stack(
fit: StackFit.expand,
children: [
if (_appMounted) const App(key: ValueKey('app-shell')),
if (_showPostLoginSplash)
PostLoginSplash(
key: const ValueKey('post-login-splash'),
onComplete: () => setState(
() => _showPostLoginSplash = false,
),
),
],
);
case AccountStatus.loggedOut:
return const Login();
case AccountStatus.undefined: