CTK 1.2.1
This commit is contained in:
20
lib/onboarding_prefs.dart
Normal file
20
lib/onboarding_prefs.dart
Normal file
@@ -0,0 +1,20 @@
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
/// Regista localmente se o utilizador já viu o tutorial guiado da Home
|
||||
/// ([showCoachMarkTour] a partir de [LoggedHomeScreen]), para só o mostrar
|
||||
/// automaticamente uma vez.
|
||||
class OnboardingPrefs {
|
||||
const OnboardingPrefs._();
|
||||
|
||||
static const String _kSeenTutorialKey = 'seen_onboarding_tutorial_v1';
|
||||
|
||||
static Future<bool> hasSeenTutorial() async {
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
return prefs.getBool(_kSeenTutorialKey) ?? false;
|
||||
}
|
||||
|
||||
static Future<void> markTutorialSeen() async {
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
await prefs.setBool(_kSeenTutorialKey, true);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user