-
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
ba47934
commit 2ff25e8
Showing
16 changed files
with
230 additions
and
29 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
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
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
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
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
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
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,7 @@ | ||
import 'package:survey/models/survey_info.dart'; | ||
import 'package:survey/models/survey_question_info.dart'; | ||
|
||
// ignore: must_be_immutable | ||
class DetailedSurveyInfo extends SurveyInfo { | ||
late List<SurveyQuestionInfo> questions; | ||
} |
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
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,87 @@ | ||
import 'package:object_mapper/object_mapper.dart'; | ||
|
||
class SurveyQuestionInfo with Mappable { | ||
String? id; | ||
String? content; | ||
int? displayOrder; | ||
SurveyQuestionPickType? pickType; | ||
SurveyQuestionDisplayType? displayType; | ||
bool? isMandatory; | ||
String? coverImageUrl; | ||
double? coverImageOpacity; | ||
|
||
@override | ||
void mapping(Mapper map) { | ||
map<String>( | ||
"id", | ||
id, | ||
(v) => id = v as String, | ||
); | ||
map<String>( | ||
"attributes.text", | ||
content, | ||
(v) => content = v as String, | ||
); | ||
map<int>( | ||
"attributes.display_order", | ||
displayOrder, | ||
(v) => displayOrder = v as int, | ||
); | ||
map<SurveyQuestionPickType>( | ||
"attributes.pick", | ||
pickType, | ||
(v) => pickType = v as SurveyQuestionPickType?, | ||
const EnumTransform<SurveyQuestionPickType, String>(), | ||
); | ||
map<SurveyQuestionDisplayType>( | ||
"attributes.display_type", | ||
displayType, | ||
(v) => displayType = v as SurveyQuestionDisplayType?, | ||
const EnumTransform<SurveyQuestionDisplayType, String>(), | ||
); | ||
map<bool>( | ||
"attributes.is_mandatory", | ||
isMandatory, | ||
(v) => isMandatory = v as bool, | ||
); | ||
map<String>( | ||
"attributes.cover_image_url", | ||
coverImageUrl, | ||
(v) => coverImageUrl = v as String?, | ||
); | ||
map<double>( | ||
"attributes.cover_image_opacity", | ||
coverImageOpacity, | ||
(v) => coverImageOpacity = v as double?, | ||
); | ||
} | ||
} | ||
|
||
// ignore: avoid_implementing_value_types | ||
class SurveyQuestionDisplayType extends Enumerable<String> { | ||
const SurveyQuestionDisplayType(this.rawValue); | ||
|
||
@override | ||
final String rawValue; | ||
|
||
static const intro = SurveyQuestionDisplayType("intro"); | ||
static const star = SurveyQuestionDisplayType("star"); | ||
static const heart = SurveyQuestionDisplayType("heart"); | ||
static const smiley = SurveyQuestionDisplayType("smiley"); | ||
static const choice = SurveyQuestionDisplayType("choice"); | ||
static const nps = SurveyQuestionDisplayType("NPS"); | ||
static const textarea = SurveyQuestionDisplayType("textarea"); | ||
static const textField = SurveyQuestionDisplayType("textfield"); | ||
static const outro = SurveyQuestionDisplayType("outro"); | ||
} | ||
|
||
class SurveyQuestionPickType extends Enumerable<String> { | ||
const SurveyQuestionPickType(this.rawValue); | ||
|
||
@override | ||
final String rawValue; | ||
|
||
static const none = SurveyQuestionDisplayType("none"); | ||
static const one = SurveyQuestionDisplayType("one"); | ||
static const any = SurveyQuestionDisplayType("any"); | ||
} |
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
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
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,30 @@ | ||
part of 'api_service.dart'; | ||
|
||
class ApiRawResponse with Mappable { | ||
ApiRawObject? data; | ||
Map<String, dynamic>? meta; | ||
List<ApiRawObject>? included; | ||
|
||
@override | ||
void mapping(Mapper map) { | ||
map<ApiRawObject>("data", data, (v) => data = v as ApiRawObject?); | ||
map<Map<String, dynamic>>( | ||
"meta", meta, (v) => meta = v as Map<String, dynamic>?); | ||
map<ApiRawObject>( | ||
"included", included, (v) => included = v as List<ApiRawObject>?); | ||
} | ||
} | ||
|
||
class ApiRawObject with Mappable { | ||
String? id; | ||
String? type; | ||
Map<String, dynamic>? attributes; | ||
|
||
@override | ||
void mapping(Mapper map) { | ||
map<String>("id", id, (v) => id = v as String); | ||
map<String>("type", type, (v) => type = v as String); | ||
map<Map<String, dynamic>>("attributes", attributes, | ||
(v) => attributes = v as Map<String, dynamic>); | ||
} | ||
} |
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
Oops, something went wrong.