Files
1356/lifetimer/lib/features/onboarding/application/onboarding_controller.dart
T
Tomas Dvorak 37ffb93923 feat: Complete Phase 1 - Full Flutter app implementation with comprehensive features
Version: 1.1.0

Major changes:
- Implemented complete Flutter app structure with all core features
- Added comprehensive UI screens for auth, countdown, goals, profile, settings, and social features
- Integrated Supabase backend with authentication and data repositories
- Added offline support with Hive caching and local storage
- Implemented comprehensive routing with go_router
- Added location services with Google Maps integration
- Implemented notifications and home widget support
- Added voice recording capabilities and AI chat features
- Created comprehensive test suite and documentation
- Added Android and iOS platform configurations
- Implemented achievements system and social features
- Added calendar integration and bucket list functionality

This represents a complete Phase 1 milestone with 3,775 additions across 31 files.
2026-01-04 14:33:54 +01:00

64 lines
1.8 KiB
Dart

import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:hive_flutter/hive_flutter.dart';
import '../../../core/services/analytics_service.dart';
class OnboardingController extends StateNotifier<bool> {
final AnalyticsService _analytics = AnalyticsService();
static const String _onboardingKey = 'onboarding_completed';
OnboardingController() : super(false) {
_loadOnboardingStatus();
}
Future<void> _loadOnboardingStatus() async {
try {
final box = await Hive.openBox('app_settings');
final completed = box.get(_onboardingKey, defaultValue: false);
state = completed;
} catch (e) {
state = false;
}
}
Future<void> completeOnboarding() async {
try {
final box = await Hive.openBox('app_settings');
await box.put(_onboardingKey, true);
state = true;
_analytics.logOnboardingCompleted();
} catch (e) {
_analytics.logError(error: e.toString(), context: 'completeOnboarding');
}
}
Future<void> skipOnboarding() async {
try {
final box = await Hive.openBox('app_settings');
await box.put(_onboardingKey, true);
state = true;
_analytics.logOnboardingCompleted();
} catch (e) {
_analytics.logError(error: e.toString(), context: 'skipOnboarding');
}
}
void completeStep(String stepName) {
_analytics.logOnboardingStepCompleted(stepName: stepName);
}
Future<void> resetOnboarding() async {
try {
final box = await Hive.openBox('app_settings');
await box.put(_onboardingKey, false);
state = false;
} catch (e) {
_analytics.logError(error: e.toString(), context: 'resetOnboarding');
}
}
}
final onboardingControllerProvider =
StateNotifierProvider<OnboardingController, bool>((ref) {
return OnboardingController();
});