Add auth session flow and sign-in UX
This commit is contained in:
+17
-3
@@ -1,22 +1,36 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:relationship_saver/core/config/app_theme.dart';
|
||||
import 'package:relationship_saver/features/auth/session_controller.dart';
|
||||
import 'package:relationship_saver/features/auth/sign_in_view.dart';
|
||||
import 'package:relationship_saver/features/home/app_shell.dart';
|
||||
import 'package:relationship_saver/integrations/backend/models/backend_models.dart';
|
||||
|
||||
void main() {
|
||||
runApp(const ProviderScope(child: RelationshipSaverApp()));
|
||||
}
|
||||
|
||||
class RelationshipSaverApp extends StatelessWidget {
|
||||
class RelationshipSaverApp extends ConsumerWidget {
|
||||
const RelationshipSaverApp({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final AsyncValue<AuthSession?> sessionState = ref.watch(
|
||||
sessionControllerProvider,
|
||||
);
|
||||
|
||||
return MaterialApp(
|
||||
title: 'Relationship Saver',
|
||||
debugShowCheckedModeBanner: false,
|
||||
theme: AppTheme.light(),
|
||||
home: const AppShell(),
|
||||
home: Scaffold(
|
||||
body: sessionState.when(
|
||||
data: (session) =>
|
||||
session == null ? const SignInView() : const AppShell(),
|
||||
loading: () => const Center(child: CircularProgressIndicator()),
|
||||
error: (Object error, StackTrace stackTrace) => const SignInView(),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user