-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(#451): basic free text question data model
- Loading branch information
1 parent
17ef604
commit f545171
Showing
4 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
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
20 changes: 20 additions & 0 deletions
20
core/lib/src/models/questionnaire/questions/free_text_question.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,20 @@ | ||
import 'package:json_annotation/json_annotation.dart'; | ||
|
||
import 'package:studyu_core/core.dart'; | ||
|
||
part 'free_text_question.g.dart'; | ||
|
||
@JsonSerializable() | ||
class FreeTextQuestion extends Question<String> { | ||
static const String questionType = 'freeText'; | ||
|
||
FreeTextQuestion(): super(questionType); | ||
|
||
FreeTextQuestion.withId(): super.withId(questionType); | ||
|
||
factory FreeTextQuestion.fromJson(Map<String, dynamic> json) => _$FreeTextQuestionFromJson(json); | ||
@override | ||
Map<String, dynamic> toJson() => _$FreeTextQuestionToJson(this); | ||
|
||
Answer<String> constructAnswer(String response) => Answer.forQuestion(this, response); | ||
} |
36 changes: 36 additions & 0 deletions
36
core/lib/src/models/questionnaire/questions/free_text_question.g.dart
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
export 'annotated_scale_question.dart'; | ||
export 'boolean_question.dart'; | ||
export 'choice_question.dart'; | ||
export 'free_text_question.dart'; | ||
export 'scale_question.dart'; | ||
export 'slider_question.dart'; | ||
export 'visual_analogue_question.dart'; |