Fix white screen after login: pushReplacement to DashboardScreen; main decides home by email presence; add missing imports
This commit is contained in:
@@ -30,6 +30,7 @@ class MyApp extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Provider.of<ThemeProvider>(context);
|
||||
final auth = Provider.of<AuthService>(context, listen: false);
|
||||
return MaterialApp(
|
||||
title: 'Login Vault',
|
||||
theme: ThemeData(
|
||||
@@ -43,13 +44,10 @@ class MyApp extends StatelessWidget {
|
||||
colorSchemeSeed: Colors.indigo,
|
||||
),
|
||||
themeMode: theme.mode,
|
||||
home: registered
|
||||
? DashboardScreen(
|
||||
auth: context.read<AuthService>(),
|
||||
theme: theme,
|
||||
email: email,
|
||||
)
|
||||
: AuthScreen(auth: context.read<AuthService>()),
|
||||
// decide home: if registered AND email known -> Dashboard, else Auth.
|
||||
home: (registered && email.isNotEmpty)
|
||||
? DashboardScreen(auth: auth, theme: theme, email: email)
|
||||
: AuthScreen(auth: auth),
|
||||
debugShowCheckedModeBanner: false,
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user