chore: fix getting started showing up everytime

This commit is contained in:
Kingkor Roy Tirtho 2024-03-08 23:07:55 +06:00
parent 4a044498a4
commit a248a4b48c
3 changed files with 12 additions and 9 deletions

View File

@ -70,7 +70,6 @@ Future<void> main(List<String> rawArgs) async {
}
await KVStoreService.initialize();
KVStoreService.doneGettingStarted = false;
final hiveCacheDir =
kIsWeb ? null : (await getApplicationSupportDirectory()).path;

View File

@ -101,9 +101,11 @@ class GettingStartedScreenSupportSection extends HookConsumerWidget {
style: TextButton.styleFrom(
foregroundColor: Colors.white,
),
onPressed: () {
KVStoreService.doneGettingStarted = true;
context.go("/");
onPressed: () async {
await KVStoreService.setDoneGettingStarted(true);
if (context.mounted) {
context.go("/");
}
},
),
),
@ -115,9 +117,11 @@ class GettingStartedScreenSupportSection extends HookConsumerWidget {
backgroundColor: const Color(0xff1db954),
foregroundColor: Colors.white,
),
onPressed: () {
KVStoreService.doneGettingStarted = true;
context.push("/login");
onPressed: () async {
await KVStoreService.setDoneGettingStarted(true);
if (context.mounted) {
context.push("/login");
}
},
),
],

View File

@ -10,6 +10,6 @@ abstract class KVStoreService {
static bool get doneGettingStarted =>
sharedPreferences.getBool('doneGettingStarted') ?? false;
static set doneGettingStarted(bool value) =>
sharedPreferences.setBool('doneGettingStarted', value);
static Future<void> setDoneGettingStarted(bool value) async =>
await sharedPreferences.setBool('doneGettingStarted', value);
}