Update: 2026-08-08 17:35:50

This commit is contained in:
Hamza-Ayed
2026-08-08 17:35:50 +03:00
parent 8c9f729ecd
commit e63f990aea
18 changed files with 261 additions and 75 deletions
@@ -5,11 +5,8 @@ import 'package:get/get.dart';
import '../../../../constant/box_name.dart';
import '../../../../constant/links.dart';
import '../../../../constant/style.dart';
import '../../../../main.dart';
import '../../../../views/widgets/elevated_btn.dart';
import '../../../functions/crud.dart';
import '../../../functions/encrypt_decrypt.dart';
class HelpController extends GetxController {
bool isLoading = false;
@@ -20,6 +17,9 @@ class HelpController extends GetxController {
String status = '';
String qustion = '';
late int indexQuestion = 0;
Map<int, String> aiReplies = {};
getIndex(int i, String qustion1) async {
indexQuestion = i;
qustion = qustion1;
@@ -38,13 +38,15 @@ class HelpController extends GetxController {
update();
if (d['status'].toString() == 'success') {
getHelpQuestion();
// Get.snackbar('Feedback data saved successfully'.tr, '',
// backgroundColor: AppColor.greenColor,
// snackPosition: SnackPosition.BOTTOM);
helpQuestionController.clear();
}
}
void getHelpQuestion() async {
getHelpQuestionFuture();
}
Future<void> getHelpQuestionFuture() async {
isLoading = true;
update();
var res = await CRUD().get(link: AppLink.gethelpCenter, payload: {
@@ -52,27 +54,9 @@ class HelpController extends GetxController {
});
if (res == "failure") {
isLoading = false;
helpQuestionDate = {'message': []};
update();
Get.defaultDialog(
title: 'There is no help Question here'.tr,
titleStyle: AppStyle.title,
middleText: '',
confirm: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
MyElevatedButton(
title: 'Add Question'.tr,
onPressed: () {
Get.back();
}),
MyElevatedButton(
title: 'Back'.tr,
onPressed: () {
Get.back();
Get.back();
}),
],
));
return;
}
helpQuestionDate = jsonDecode(res);
isLoading = false;
@@ -89,14 +73,20 @@ class HelpController extends GetxController {
status = 'not yet';
isLoading = false;
update();
} else {
status = 'done';
helpQuestionRepleyDate = jsonDecode(res);
isLoading = false;
update();
}
helpQuestionRepleyDate = jsonDecode(res);
isLoading = false;
update();
}
@override
void onInit() {
final storedReplies = box.read<Map<String, dynamic>>('ai_replies') ?? {};
aiReplies = storedReplies
.map((key, value) => MapEntry(int.parse(key), value.toString()));
getHelpQuestion();
super.onInit();
}