Skip to content

Commit 0d0df12

Browse files
authored
Merge pull request #75 from flutter-news-app-full-source-code/fix-demo-mode-black-screen-no-content
Fix demo mode black screen no content
2 parents 9d4fcdd + f69ab08 commit 0d0df12

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

lib/router/router.dart

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,24 @@ GoRouter createRouter({
8989
' AppStatus: $appStatus',
9090
);
9191

92-
// --- Define Key Paths ---
9392
const rootPath = '/';
9493
const authenticationPath = Routes.authentication;
9594
const feedPath = Routes.feed;
9695
final isGoingToAuth = currentLocation.startsWith(authenticationPath);
9796

97+
// --- Workaround for Demo Environment ---
98+
// In the demo environment, the initial auth state from the in-memory
99+
// client might not be emitted before the first redirect check. If the app
100+
// is still in the `initial` state, we explicitly redirect to the
101+
// authentication page to begin the demo flow, avoiding the black screen.
102+
if (appStatus == AppStatus.initial &&
103+
environment == local_config.AppEnvironment.demo) {
104+
print(
105+
' Redirect (Workaround): In demo mode with initial status. Forcing to authentication.',
106+
);
107+
return authenticationPath;
108+
}
109+
98110
// With the new App startup architecture, the router is only active when
99111
// the app is in a stable, running state. The `redirect` function's
100112
// only responsibility is to handle auth-based route protection.

pubspec.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ packages:
7272
description:
7373
path: "."
7474
ref: HEAD
75-
resolved-ref: f48dc0555b1a28ed3c51215f3a93403dbbc46ea0
75+
resolved-ref: "9c25c6bff76c554e5220368536fcb9370758f48f"
7676
url: "https://github.com/flutter-news-app-full-source-code/auth-inmemory.git"
7777
source: git
7878
version: "0.0.0"
@@ -178,7 +178,7 @@ packages:
178178
description:
179179
path: "."
180180
ref: HEAD
181-
resolved-ref: "7a1b54f8c0f94f6c04af3404c8110181e080b5c4"
181+
resolved-ref: f648500814ec636a2930498756029d29b363194a
182182
url: "https://github.com/flutter-news-app-full-source-code/core.git"
183183
source: git
184184
version: "0.0.0"
@@ -426,10 +426,10 @@ packages:
426426
dependency: "direct main"
427427
description:
428428
name: go_router
429-
sha256: c489908a54ce2131f1d1b7cc631af9c1a06fac5ca7c449e959192089f9489431
429+
sha256: "8b1f37dfaf6e958c6b872322db06f946509433bec3de753c3491a42ae9ec2b48"
430430
url: "https://pub.dev"
431431
source: hosted
432-
version: "16.0.0"
432+
version: "16.1.0"
433433
google_fonts:
434434
dependency: "direct main"
435435
description:

0 commit comments

Comments
 (0)