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.
28 lines
811 B
Dart
28 lines
811 B
Dart
import 'package:get/get.dart';
|
|
|
|
import '../views/model/FAQS.dart';
|
|
|
|
class FaqsFirstController extends GetxController {
|
|
late SendingMoney sendMoney;
|
|
final searchText = ''.obs;
|
|
RxList<Question> filteredListQuestions = <Question>[].obs;
|
|
@override
|
|
onInit() {
|
|
super.onInit();
|
|
sendMoney = Get.arguments;
|
|
filteredListQuestions.value = sendMoney.questions;
|
|
debounce(searchText, (_) => filterListQuestions(), time: const Duration(milliseconds: 300));
|
|
}
|
|
|
|
void filterListQuestions() {
|
|
if (searchText.value.isEmpty) {
|
|
filteredListQuestions.value = sendMoney.questions;
|
|
} else {
|
|
filteredListQuestions.value = sendMoney.questions
|
|
.where((question) =>
|
|
question.title.toLowerCase().contains(searchText.value.toLowerCase()))
|
|
.toList();
|
|
}
|
|
}
|
|
}
|