Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
308 changes: 285 additions & 23 deletions core/example/assets/questions.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,289 @@
{
"1": {
"index": 1,
"title": "Intro",
"subtitle": "",
"type": "Intro",
"isSkip": false,
"content": "You may simply need a single, brief answer without discussion. Other times, you may want to talk through a scenario, evaluate how well a group is learning new material or solicit feedback. The types of questions you ask directly impact the type of answer you receive.",
"payload": {
"mainButtonTitle": "NEXT"
"schemeVersion": 1,
"commonTheme": {
"slider": {
"index": 0,
"theme": {
"activeColor": 4278190080,
"inactiveColor": 4291611852,
"thumbColor": 4278190080,
"thumbRadius": 16,
"thickness": 8,
"fill": 4294967295,
"titleColor": 4278190080,
"titleSize": 16,
"subtitleColor": 4278190080,
"subtitleSize": 12,
"primaryButtonFill": 4278190080,
"primaryButtonTextColor": 4294967295,
"primaryButtonTextSize": 12,
"primaryButtonRadius": 10,
"secondaryButtonFill": 4278190080,
"secondaryButtonTextColor": 4294967295,
"secondaryButtonTextSize": 12,
"secondaryButtonRadius": 10
},
"minValue": 0,
"maxValue": 10,
"divisions": 10,
"initialValue": 5,
"title": "Slider",
"subtitle": "",
"type": "Slider",
"isSkip": false,
"content": "You may simply need a single, brief answer without discussion. Other times, you may want to talk through a scenario, evaluate how well a group is learning new material or solicit feedback. The types of questions you ask directly impact the type of answer you receive.",
"secondaryButtonText": "Skip",
"primaryButtonText": "NEXT"
},
"intro": {
"index": 0,
"title": "Intro",
"subtitle": "",
"type": "Intro",
"isSkip": false,
"content": "You may simply need a single, brief answer without discussion. Other times, you may want to talk through a scenario, evaluate how well a group is learning new material or solicit feedback. The types of questions you ask directly impact the type of answer you receive.",
"theme": {
"fill": 4294967295,
"titleColor": 4278190080,
"titleSize": 16,
"subtitleColor": 4278190080,
"subtitleSize": 12,
"primaryButtonFill": 4278190080,
"primaryButtonTextColor": 4294967295,
"primaryButtonTextSize": 12,
"primaryButtonRadius": 10,
"secondaryButtonFill": 4278190080,
"secondaryButtonTextColor": 4294967295,
"secondaryButtonTextSize": 12,
"secondaryButtonRadius": 10
},
"secondaryButtonText": "Skip",
"primaryButtonText": "NEXT"
},
"input": {
"index": 0,
"title": "Input",
"subtitle": "",
"type": "Input",
"isSkip": false,
"content": "You may simply need a single, brief answer without discussion. Other times, you may want to talk through a scenario, evaluate how well a group is learning new material or solicit feedback. The types of questions you ask directly impact the type of answer you receive.",
"theme": {
"inputFill": 4294967295,
"borderColor": 4278190080,
"borderWidth": 1,
"hintColor": 4285690482,
"hintSize": 16,
"textColor": 4278190080,
"textSize": 16,
"lines": 1,
"isMultiline": 0,
"errorText": "Error",
"inputType": "text",
"verticalPadding": 14,
"horizontalPadding": 14,
"fill": 4294967295,
"titleColor": 4278190080,
"titleSize": 16,
"subtitleColor": 4278190080,
"subtitleSize": 12,
"primaryButtonFill": 4278190080,
"primaryButtonTextColor": 4294967295,
"primaryButtonTextSize": 12,
"primaryButtonRadius": 10,
"secondaryButtonFill": 4278190080,
"secondaryButtonTextColor": 4294967295,
"secondaryButtonTextSize": 12,
"secondaryButtonRadius": 10
},
"payload": {
"validator": 0,
"regex": ".*",
"is_obscured": false,
"isMultipleChoice": null
},
"secondaryButtonText": "Skip",
"primaryButtonText": "NEXT"
},
"choice": {
"index": 0,
"title": "Choice",
"subtitle": "",
"type": "Choice",
"isSkip": false,
"content": "You may simply need a single, brief answer without discussion. Other times, you may want to talk through a scenario, evaluate how well a group is learning new material or solicit feedback. The types of questions you ask directly impact the type of answer you receive.",
"theme": {
"activeColor": 4278190080,
"inactiveColor": 4288585374,
"fill": 4294967295,
"titleColor": 4278190080,
"titleSize": 16,
"subtitleColor": 4278190080,
"subtitleSize": 12,
"primaryButtonFill": 4278190080,
"primaryButtonTextColor": 4294967295,
"primaryButtonTextSize": 12,
"primaryButtonRadius": 10,
"secondaryButtonFill": 4278190080,
"secondaryButtonTextColor": 4294967295,
"secondaryButtonTextSize": 12,
"secondaryButtonRadius": 10
},
"payload": {
"isMultipleChoice": false,
"options": [
"First option",
"Second option",
"ThirdOption"
],
"selectedOptions": null,
"ruleType": 0,
"ruleValue": 0
},
"secondaryButtonText": "Skip",
"primaryButtonText": "NEXT"
}
},
"2": {
"index": 2,
"title": "Input",
"subtitle": "",
"type": "Input",
"isSkip": false,
"content": "You may simply need a single, brief answer without discussion. Other times, you may want to talk through a scenario, evaluate how well a group is learning new material or solicit feedback. The types of questions you ask directly impact the type of answer you receive.",
"payload": {
"validator": 1,
"regex": "^[0-9]+$",
"is_obscured": false,
"hintText": null
"questions": [
{
"index": 1,
"title": "Intro",
"subtitle": "",
"type": "Intro",
"isSkip": false,
"content": "You may simply need a single, brief answer without discussion. Other times, you may want to talk through a scenario, evaluate how well a group is learning new material or solicit feedback. The types of questions you ask directly impact the type of answer you receive.",
"theme": {
"fill": 4294967295,
"titleColor": 4278190080,
"titleSize": 16,
"subtitleColor": 4278190080,
"subtitleSize": 12,
"primaryButtonFill": 4278190080,
"primaryButtonTextColor": 4294967295,
"primaryButtonTextSize": 12,
"primaryButtonRadius": 10,
"secondaryButtonFill": 4278190080,
"secondaryButtonTextColor": 4294967295,
"secondaryButtonTextSize": 12,
"secondaryButtonRadius": 10
},
"secondaryButtonText": "Skip",
"primaryButtonText": "NEXT"
},
{
"index": 2,
"title": "Input",
"subtitle": "",
"type": "Input",
"isSkip": false,
"content": "You may simply need a single, brief answer without discussion. Other times, you may want to talk through a scenario, evaluate how well a group is learning new material or solicit feedback. The types of questions you ask directly impact the type of answer you receive.",
"theme": {
"inputFill": 4294967295,
"borderColor": 4278190080,
"borderWidth": 1,
"hintColor": 4285690482,
"hintSize": 16,
"textColor": 4278190080,
"textSize": 16,
"lines": 1,
"isMultiline": 0,
"errorText": "Error",
"inputType": "text",
"verticalPadding": 14,
"horizontalPadding": 14,
"fill": 4294967295,
"titleColor": 4278190080,
"titleSize": 16,
"subtitleColor": 4278190080,
"subtitleSize": 12,
"primaryButtonFill": 4278190080,
"primaryButtonTextColor": 4294967295,
"primaryButtonTextSize": 12,
"primaryButtonRadius": 10,
"secondaryButtonFill": 4278190080,
"secondaryButtonTextColor": 4294967295,
"secondaryButtonTextSize": 12,
"secondaryButtonRadius": 10
},
"payload": {
"validator": 0,
"regex": ".*",
"is_obscured": false,
"isMultipleChoice": null
},
"secondaryButtonText": "Skip",
"primaryButtonText": "NEXT"
},
{
"index": 3,
"title": "Choice",
"subtitle": "",
"type": "Choice",
"isSkip": false,
"content": "You may simply need a single, brief answer without discussion. Other times, you may want to talk through a scenario, evaluate how well a group is learning new material or solicit feedback. The types of questions you ask directly impact the type of answer you receive.",
"theme": {
"activeColor": 4278190080,
"inactiveColor": 4288585374,
"fill": 4294967295,
"titleColor": 4278190080,
"titleSize": 16,
"subtitleColor": 4278190080,
"subtitleSize": 12,
"primaryButtonFill": 4278190080,
"primaryButtonTextColor": 4294967295,
"primaryButtonTextSize": 12,
"primaryButtonRadius": 10,
"secondaryButtonFill": 4278190080,
"secondaryButtonTextColor": 4294967295,
"secondaryButtonTextSize": 12,
"secondaryButtonRadius": 10
},
"payload": {
"isMultipleChoice": false,
"options": [
"First option",
"Second option",
"ThirdOption"
],
"selectedOptions": null,
"ruleType": 0,
"ruleValue": 0
},
"secondaryButtonText": "Skip",
"primaryButtonText": "NEXT"
},
{
"index": 4,
"theme": {
"activeColor": 4278190080,
"inactiveColor": 4291611852,
"thumbColor": 4278190080,
"thumbRadius": 16,
"thickness": 8,
"fill": 4294967295,
"titleColor": 4278190080,
"titleSize": 16,
"subtitleColor": 4278190080,
"subtitleSize": 12,
"primaryButtonFill": 4278190080,
"primaryButtonTextColor": 4294967295,
"primaryButtonTextSize": 12,
"primaryButtonRadius": 10,
"secondaryButtonFill": 4278190080,
"secondaryButtonTextColor": 4294967295,
"secondaryButtonTextSize": 12,
"secondaryButtonRadius": 10
},
"minValue": 0,
"maxValue": 10,
"divisions": 10,
"initialValue": 5,
"title": "Slider",
"subtitle": "",
"type": "Slider",
"isSkip": false,
"content": "You may simply need a single, brief answer without discussion. Other times, you may want to talk through a scenario, evaluate how well a group is learning new material or solicit feedback. The types of questions you ask directly impact the type of answer you receive.",
"secondaryButtonText": "Skip",
"primaryButtonText": "NEXT"
}
}
}
]
}
16 changes: 10 additions & 6 deletions core/lib/src/data/mappers/themes/choice_question_theme_mapper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,21 @@ class ChoiceQuestionThemeMapper
inactiveColor: Color(json[_Fields.inactiveColor]),
fill: Color(json[_Fields.fill]),
titleColor: Color(json[_Fields.titleColor]),
titleSize: json[_Fields.titleSize],
titleSize: (json[_Fields.titleSize] as num).toDouble(),
subtitleColor: Color(json[_Fields.subtitleColor]),
subtitleSize: json[_Fields.subtitleSize],
subtitleSize: (json[_Fields.subtitleSize] as num).toDouble(),
primaryButtonFill: Color(json[_Fields.primaryButtonFill]),
primaryButtonTextColor: Color(json[_Fields.primaryButtonTextColor]),
primaryButtonTextSize: json[_Fields.primaryButtonTextSize],
primaryButtonRadius: json[_Fields.primaryButtonRadius],
primaryButtonTextSize:
(json[_Fields.primaryButtonTextSize] as num).toDouble(),
primaryButtonRadius:
(json[_Fields.primaryButtonRadius] as num).toDouble(),
secondaryButtonFill: Color(json[_Fields.secondaryButtonFill]),
secondaryButtonTextColor: Color(json[_Fields.secondaryButtonTextColor]),
secondaryButtonTextSize: json[_Fields.secondaryButtonTextSize],
secondaryButtonRadius: json[_Fields.secondaryButtonRadius],
secondaryButtonTextSize:
(json[_Fields.secondaryButtonTextSize] as num).toDouble(),
secondaryButtonRadius:
(json[_Fields.secondaryButtonRadius] as num).toDouble(),
);
}

Expand Down
26 changes: 15 additions & 11 deletions core/lib/src/data/mappers/themes/input_question_theme_mapper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,30 +38,34 @@ class InputQuestionThemeMapper extends QuestionThemeMapper<InputQuestionTheme> {
return InputQuestionTheme(
inputFill: Color(json[_Fields.inputFill]),
borderColor: Color(json[_Fields.borderColor]),
borderWidth: json[_Fields.borderWidth],
borderWidth: (json[_Fields.borderWidth] as num).toDouble(),
hintColor: Color(json[_Fields.hintColor]),
hintSize: json[_Fields.hintSize],
hintSize: (json[_Fields.hintSize] as num).toDouble(),
textColor: Color(json[_Fields.textColor]),
textSize: json[_Fields.textSize],
textSize: (json[_Fields.textSize] as num).toDouble(),
lines: json[_Fields.lines],
verticalPadding: json[_Fields.verticalPadding],
verticalPadding: (json[_Fields.verticalPadding] as num).toDouble(),
isMultiline: json[_Fields.isMultiLine] == 1,
errorText: json[_Fields.errorText],
inputType: InputType.fromJson(json[_Fields.inputType]),
horizontalPadding: json[_Fields.horizontalPadding],
horizontalPadding: (json[_Fields.horizontalPadding] as num).toDouble(),
fill: Color(json[_Fields.fill]),
titleColor: Color(json[_Fields.titleColor]),
titleSize: json[_Fields.titleSize],
titleSize: (json[_Fields.titleSize] as num).toDouble(),
subtitleColor: Color(json[_Fields.subtitleColor]),
subtitleSize: json[_Fields.subtitleSize],
subtitleSize: (json[_Fields.subtitleSize] as num).toDouble(),
primaryButtonFill: Color(json[_Fields.primaryButtonFill]),
primaryButtonTextColor: Color(json[_Fields.primaryButtonTextColor]),
primaryButtonTextSize: json[_Fields.primaryButtonTextSize],
primaryButtonRadius: json[_Fields.primaryButtonRadius],
primaryButtonTextSize:
(json[_Fields.primaryButtonTextSize] as num).toDouble(),
primaryButtonRadius:
(json[_Fields.primaryButtonRadius] as num).toDouble(),
secondaryButtonFill: Color(json[_Fields.secondaryButtonFill]),
secondaryButtonTextColor: Color(json[_Fields.secondaryButtonTextColor]),
secondaryButtonTextSize: json[_Fields.secondaryButtonTextSize],
secondaryButtonRadius: json[_Fields.secondaryButtonRadius],
secondaryButtonTextSize:
(json[_Fields.secondaryButtonTextSize] as num).toDouble(),
secondaryButtonRadius:
(json[_Fields.secondaryButtonRadius] as num).toDouble(),
);
}

Expand Down
Loading