small fix, don't worry about it

This commit is contained in:
Tomas Dvorak
2026-04-10 12:05:40 +02:00
parent 7b7ed0083f
commit 5ab2773f98
55 changed files with 3240 additions and 483 deletions
@@ -2,18 +2,38 @@ import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import '../application/auth_controller.dart';
import '../../onboarding/application/onboarding_controller.dart';
import '../../profile/application/profile_controller.dart';
import 'auth_showcase_screen.dart';
import '../../onboarding/presentation/onboarding_intro_screen.dart';
import '../../profile/presentation/profile_setup_screen.dart';
import '../../countdown/presentation/home_countdown_screen.dart';
import '../../../bootstrap/supabase_client.dart';
class AuthGate extends ConsumerWidget {
class AuthGate extends ConsumerStatefulWidget {
const AuthGate({super.key});
@override
Widget build(BuildContext context, WidgetRef ref) {
ConsumerState<AuthGate> createState() => _AuthGateState();
}
class _AuthGateState extends ConsumerState<AuthGate> {
bool _isCheckingProfile = false;
bool _profileSetupComplete = false;
@override
Widget build(BuildContext context) {
final authState = ref.watch(authControllerProvider);
final onboardingState = ref.watch(onboardingControllerProvider);
// If no backend is configured and there is no overridden auth state,
// keep the app usable by continuing through the local onboarding flow.
if (supabaseClient == null && authState == null) {
if (!onboardingState) {
return const OnboardingIntroScreen();
}
return const HomeCountdownScreen();
}
if (authState == null) {
return const AuthShowcaseScreen();
}
@@ -23,7 +43,29 @@ class AuthGate extends ConsumerWidget {
return const OnboardingIntroScreen();
}
// User is authenticated and has completed onboarding
// Check if profile setup is complete
if (!_isCheckingProfile && !_profileSetupComplete) {
_isCheckingProfile = true;
_checkProfileSetup(authState.id);
return const Scaffold(body: Center(child: CircularProgressIndicator()));
}
// If profile setup is not complete, show profile setup screen
if (!_profileSetupComplete) {
return const ProfileSetupScreen();
}
// User is authenticated and has completed onboarding and profile setup
return const HomeCountdownScreen();
}
Future<void> _checkProfileSetup(String userId) async {
final isComplete = await ref.read(profileControllerProvider.notifier).isProfileSetupComplete(userId);
if (mounted) {
setState(() {
_profileSetupComplete = isComplete;
_isCheckingProfile = false;
});
}
}
}