6 changed files with 219 additions and 150 deletions
@ -0,0 +1,34 @@ |
|||||
|
import 'package:flutter_intro/flutter_intro.dart'; |
||||
|
import 'package:get/get.dart'; |
||||
|
import 'package:get_storage/get_storage.dart'; |
||||
|
|
||||
|
class NoviceGuideService extends GetxService { |
||||
|
final GetStorage _storage = GetStorage(); |
||||
|
|
||||
|
bool isHomeGuide = false; |
||||
|
bool isAIGuide = false; |
||||
|
|
||||
|
@override |
||||
|
void onInit() { |
||||
|
super.onInit(); |
||||
|
// isHomeGuide = _storage.read('home_guide') ?? false; |
||||
|
// isAIGuide = _storage.read('ai_guide') ?? false; |
||||
|
} |
||||
|
|
||||
|
void startHomeGuide() { |
||||
|
if (!isHomeGuide) { |
||||
|
isHomeGuide = true; |
||||
|
_storage.write('home_guide', true); |
||||
|
Intro.of(Get.context!).start(group: 'home'); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
void startAIGuide() async { |
||||
|
if (!isAIGuide) { |
||||
|
await Future.delayed(const Duration(milliseconds: 100)); |
||||
|
isAIGuide = true; |
||||
|
_storage.write('ai_guide', true); |
||||
|
Intro.of(Get.context!).start(group: 'ai'); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue