-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2d1ec00
commit 4dc399d
Showing
12 changed files
with
146 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
23 changes: 23 additions & 0 deletions
23
app/lib/features/quiz_exercise/presentation/model/answer.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import 'aspect.dart'; | ||
import 'explanation.dart'; | ||
|
||
class Answer { | ||
final Aspect aspect; | ||
final List<dynamic> correctAnswer; | ||
final Explanation explanation; | ||
|
||
Answer({ | ||
required this.aspect, | ||
required this.correctAnswer, | ||
required this.explanation, | ||
}); | ||
|
||
factory Answer.fromJson(Map<String, dynamic> json) { | ||
return Answer( | ||
aspect: Aspect.fromJson(json['aspect'] as Map<String, dynamic>), | ||
correctAnswer: | ||
json['correctAnswer'].cast<Map<String, dynamic>>() as List<dynamic>, | ||
explanation: | ||
Explanation.fromJson(json['explanation'] as Map<String, dynamic>)); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
app/lib/features/quiz_exercise/presentation/model/aspect.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
class Aspect { | ||
final String content; | ||
final String label; | ||
Aspect({required this.content, required this.label}); | ||
|
||
factory Aspect.fromJson(Map<String, dynamic> json) { | ||
return Aspect( | ||
content: json['content'] as String, | ||
label: json['label'] as String, | ||
); | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
app/lib/features/quiz_exercise/presentation/model/description.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
class Description { | ||
final String content; | ||
Description({required this.content}); | ||
|
||
factory Description.fromJson(Map<String, dynamic> json) { | ||
return Description(content: json['content'] as String); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
app/lib/features/quiz_exercise/presentation/model/explanation.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
class Explanation { | ||
final String content; | ||
|
||
Explanation({required this.content}); | ||
|
||
factory Explanation.fromJson(Map<String, dynamic> json) { | ||
return Explanation( | ||
content: json['content'] as String, | ||
); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
app/lib/features/quiz_exercise/presentation/model/options.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
class Options { | ||
final String content; | ||
final String id; | ||
Options({required this.content, required this.id}); | ||
|
||
factory Options.fromJson(Map<String, dynamic> json) { | ||
return Options( | ||
content: json['content'] as String, | ||
id: json['id'] as String, | ||
); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
app/lib/features/quiz_exercise/presentation/model/questions.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import 'options.dart'; | ||
|
||
class Question { | ||
final String content; | ||
final List<Options> options; | ||
|
||
Question({required this.content, required this.options}); | ||
|
||
factory Question.fromJson(Map<String, dynamic> json) { | ||
return Question( | ||
content: json['content'] as String, | ||
options: json['options'].cast<Map<String, dynamic>>() as List<Options>, | ||
); | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
app/lib/features/quiz_exercise/presentation/model/quiz_exercise.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import 'description.dart'; | ||
import 'questions.dart'; | ||
|
||
class QuizExerciseModel { | ||
final String id; | ||
final String country; | ||
final String challengeGroup; | ||
final String title; | ||
final String type; | ||
final String source; | ||
final Description description; | ||
final Question question; | ||
|
||
QuizExerciseModel({ | ||
required this.id, | ||
required this.country, | ||
required this.challengeGroup, | ||
required this.title, | ||
required this.source, | ||
required this.type, | ||
required this.description, | ||
required this.question, | ||
}); | ||
|
||
factory QuizExerciseModel.fromJson(Map<String, dynamic> json) { | ||
return QuizExerciseModel( | ||
id: json['id'] as String, | ||
country: json['country'] as String, | ||
challengeGroup: json['challenge_group'] as String, | ||
title: json['title'] as String, | ||
source: json['source'] as String, | ||
type: json['type'] as String, | ||
description: | ||
Description.fromJson(json['description'] as Map<String, dynamic>), | ||
question: Question.fromJson(json['question'] as Map<String, dynamic>), | ||
); | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
app/lib/features/quiz_exercise/presentation/repositories/quiz_exercise.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|