This commit is contained in:
2026-06-29 12:20:43 +03:00
parent 4b5c6be212
commit 4b548adb9a
7 changed files with 131 additions and 58 deletions
+12 -3
View File
@@ -4,18 +4,27 @@ import 'package:shared_preferences/shared_preferences.dart';
class OnboardingService {
static const _key = 'onboarding_completed';
static bool _shownInSession = false;
static SharedPreferences? _staticPrefs;
final SharedPreferences _prefs;
OnboardingService(this._prefs);
OnboardingService(this._prefs) {
_staticPrefs = _prefs;
}
bool get shouldShowOnboarding {
static bool get shouldShowOnboarding {
if (kDebugMode) {
return !_shownInSession;
}
return !(_prefs.getBool(_key) ?? false);
return !(_staticPrefs?.getBool(_key) ?? false);
}
static void markCompleted() {
_shownInSession = true;
}
bool get shouldShowOnboardingInstance => shouldShowOnboarding;
Future<void> completeOnboarding() async {
_shownInSession = true;
if (!kDebugMode) {