24 lines
630 B
Dart
24 lines
630 B
Dart
/// 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();
|
|
}
|
|
}
|