fix login 2
This commit is contained in:
@@ -0,0 +1,23 @@
|
|||||||
|
/// Routes to [LoginScreen] or [MainShell] based on PocketBase auth.
|
||||||
|
library;
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
import '../providers/auth_provider.dart';
|
||||||
|
import 'login_screen.dart';
|
||||||
|
import 'main_shell.dart';
|
||||||
|
|
||||||
|
/// Root after splash: signed-out users see login; signed-in users see the shell.
|
||||||
|
class AuthGate extends StatelessWidget {
|
||||||
|
const AuthGate({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final auth = context.watch<AuthController>();
|
||||||
|
if (!auth.isLoggedIn) {
|
||||||
|
return const LoginScreen(asRoot: true);
|
||||||
|
}
|
||||||
|
return const MainShell();
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user