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.
188 lines
4.4 KiB
Dart
188 lines
4.4 KiB
Dart
|
1 month ago
|
class FaqsModel {
|
||
|
|
List<SendingMoney> sendingMoney;
|
||
|
|
|
||
|
|
FaqsModel({required this.sendingMoney});
|
||
|
|
|
||
|
|
factory FaqsModel.fromMap(Map<String, dynamic>? map) {
|
||
|
|
return FaqsModel(
|
||
|
|
sendingMoney: List<SendingMoney>.from((map?['Sending_money'] ?? []).map((x) => SendingMoney.fromMap(x))),
|
||
|
|
);
|
||
|
|
}
|
||
|
|
|
||
|
|
Map<String, dynamic> toMap() {
|
||
|
|
return {
|
||
|
|
'Sending_money': sendingMoney.map((x) => x.toMap()).toList(),
|
||
|
|
};
|
||
|
|
}
|
||
|
|
|
||
|
|
@override
|
||
|
|
String toString() {
|
||
|
|
return 'FaqsModel{sendingMoney: $sendingMoney}';
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
class SendingMoney {
|
||
|
|
String title;
|
||
|
|
String description;
|
||
|
|
String imageProvider;
|
||
|
|
List<Question> questions;
|
||
|
|
|
||
|
|
SendingMoney({
|
||
|
|
required this.title,
|
||
|
|
required this.description,
|
||
|
|
required this.imageProvider,
|
||
|
|
required this.questions,
|
||
|
|
});
|
||
|
|
|
||
|
|
factory SendingMoney.fromMap(Map<String, dynamic>? map) {
|
||
|
|
return SendingMoney(
|
||
|
|
title: map?['title'] ?? "",
|
||
|
|
description: map?['description'] ?? "",
|
||
|
|
imageProvider: map?['ImageProvider'] ?? "",
|
||
|
|
questions: List<Question>.from((map?['questions'] ?? []).map((x) => Question.fromMap(x))),
|
||
|
|
);
|
||
|
|
}
|
||
|
|
|
||
|
|
Map<String, dynamic> toMap() {
|
||
|
|
return {
|
||
|
|
'title': title,
|
||
|
|
'description': description,
|
||
|
|
'ImageProvider': imageProvider,
|
||
|
|
'questions': questions.map((x) => x.toMap()).toList(),
|
||
|
|
};
|
||
|
|
}
|
||
|
|
|
||
|
|
@override
|
||
|
|
String toString() {
|
||
|
|
return 'SendingMoney{title: $title, description: $description, imageProvider: $imageProvider, questions: $questions}';
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
class Question {
|
||
|
|
String title;
|
||
|
|
List<SubQuestion> subQuestions;
|
||
|
|
|
||
|
|
Question({
|
||
|
|
required this.title,
|
||
|
|
required this.subQuestions,
|
||
|
|
});
|
||
|
|
|
||
|
|
factory Question.fromMap(Map<String, dynamic>? map) {
|
||
|
|
return Question(
|
||
|
|
title: map?['title'] ?? "",
|
||
|
|
subQuestions: List<SubQuestion>.from((map?['sub_questions'] ?? []).map((x) => SubQuestion.fromMap(x))),
|
||
|
|
);
|
||
|
|
}
|
||
|
|
|
||
|
|
Map<String, dynamic> toMap() {
|
||
|
|
return {
|
||
|
|
'title': title,
|
||
|
|
'sub_questions': subQuestions.map((x) => x.toMap()).toList(),
|
||
|
|
};
|
||
|
|
}
|
||
|
|
|
||
|
|
@override
|
||
|
|
String toString() {
|
||
|
|
return 'Question{title: $title, subQuestions: $subQuestions}';
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
class SubQuestion {
|
||
|
|
String title;
|
||
|
|
List<QuestionDetails> questionDetails;
|
||
|
|
|
||
|
|
SubQuestion({
|
||
|
|
required this.title,
|
||
|
|
required this.questionDetails,
|
||
|
|
});
|
||
|
|
|
||
|
|
factory SubQuestion.fromMap(Map<String, dynamic>? map) {
|
||
|
|
return SubQuestion(
|
||
|
|
title: map?['title'] ?? "",
|
||
|
|
questionDetails: List<QuestionDetails>.from((map?['questions_details'] ?? []).map((x) => QuestionDetails.fromMap(x))),
|
||
|
|
);
|
||
|
|
}
|
||
|
|
|
||
|
|
Map<String, dynamic> toMap() {
|
||
|
|
return {
|
||
|
|
'title': title,
|
||
|
|
'questions_details': questionDetails.map((x) => x.toMap()).toList(),
|
||
|
|
};
|
||
|
|
}
|
||
|
|
|
||
|
|
@override
|
||
|
|
String toString() {
|
||
|
|
return 'SubQuestion{title: $title, questionDetails: $questionDetails}';
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
class QuestionDetails {
|
||
|
|
String question;
|
||
|
|
String answer;
|
||
|
|
List<MultipleOption> multipleOptions;
|
||
|
|
String? builtPoint1;
|
||
|
|
String? builtPoint2;
|
||
|
|
|
||
|
|
QuestionDetails({
|
||
|
|
required this.question,
|
||
|
|
required this.answer,
|
||
|
|
required this.multipleOptions,
|
||
|
|
this.builtPoint1,
|
||
|
|
this.builtPoint2,
|
||
|
|
});
|
||
|
|
|
||
|
|
factory QuestionDetails.fromMap(Map<String, dynamic>? map) {
|
||
|
|
return QuestionDetails(
|
||
|
|
question: map?['question'] ?? "",
|
||
|
|
answer: map?['answer'] ?? "",
|
||
|
|
multipleOptions: List<MultipleOption>.from((map?['multiple_options'] ?? []).map((x) => MultipleOption.fromMap(x))),
|
||
|
|
builtPoint1: map?['built_point_1'],
|
||
|
|
builtPoint2: map?['built_point_2'],
|
||
|
|
);
|
||
|
|
}
|
||
|
|
|
||
|
|
Map<String, dynamic> toMap() {
|
||
|
|
return {
|
||
|
|
'question': question,
|
||
|
|
'answer': answer,
|
||
|
|
'multiple_options': multipleOptions.map((x) => x.toMap()).toList(),
|
||
|
|
'built_point_1': builtPoint1,
|
||
|
|
'built_point_2': builtPoint2,
|
||
|
|
};
|
||
|
|
}
|
||
|
|
|
||
|
|
@override
|
||
|
|
String toString() {
|
||
|
|
return 'QuestionDetails{question: $question, answer: $answer, multipleOptions: $multipleOptions, builtPoint1: $builtPoint1, builtPoint2: $builtPoint2}';
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
class MultipleOption {
|
||
|
|
String optionTitle;
|
||
|
|
String optionAnswer;
|
||
|
|
|
||
|
|
MultipleOption({
|
||
|
|
required this.optionTitle,
|
||
|
|
required this.optionAnswer,
|
||
|
|
});
|
||
|
|
|
||
|
|
factory MultipleOption.fromMap(Map<String, dynamic>? map) {
|
||
|
|
return MultipleOption(
|
||
|
|
optionTitle: map?['option_title'] ?? "",
|
||
|
|
optionAnswer: map?['option_answer'] ?? "",
|
||
|
|
);
|
||
|
|
}
|
||
|
|
|
||
|
|
Map<String, dynamic> toMap() {
|
||
|
|
return {
|
||
|
|
'option_title': optionTitle,
|
||
|
|
'option_answer': optionAnswer,
|
||
|
|
};
|
||
|
|
}
|
||
|
|
|
||
|
|
@override
|
||
|
|
String toString() {
|
||
|
|
return 'MultipleOption{optionTitle: $optionTitle, optionAnswer: $optionAnswer}';
|
||
|
|
}
|
||
|
|
}
|