You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
1007 B
Dart
35 lines
1007 B
Dart
import 'package:get/get.dart';
|
|
|
|
import '../../../core/utils/logs_utils.dart';
|
|
import '../views/model/FAQS.dart';
|
|
|
|
|
|
class FaqsSecondController extends GetxController {
|
|
late Question question;
|
|
final searchText = ''.obs;
|
|
RxList<SubQuestion> filteredListSubQuestions = <SubQuestion>[].obs;
|
|
|
|
@override
|
|
onInit() {
|
|
super.onInit();
|
|
question = Get.arguments;
|
|
filteredListSubQuestions.value = question.subQuestions;
|
|
debounce(searchText, (_) => filterListQuestions(), time: const Duration(milliseconds: 300));
|
|
}
|
|
|
|
@override
|
|
void onReady() {
|
|
// TODO: implement onReady
|
|
super.onReady();
|
|
dp("filteredListSubQuestions", filteredListSubQuestions.toString());
|
|
}
|
|
|
|
void filterListQuestions() {
|
|
if (searchText.value.isEmpty) {
|
|
filteredListSubQuestions.value = question.subQuestions;
|
|
} else {
|
|
filteredListSubQuestions.value = question.subQuestions.where((question) => question.title.toLowerCase().contains(searchText.value.toLowerCase())).toList();
|
|
}
|
|
}
|
|
}
|