QuestionStep.from constructor
QuestionStep.from(
- Map<String, dynamic>? element,
- List<RelevantCondition> relevantConditions
)
Implementation
factory QuestionStep.from(Map<String, dynamic>? element,
List<RelevantCondition> relevantConditions) {
List<Options> options = [];
cast<List>(element?["options"])?.forEach((el) {
options.add(Options(el?["key"], el?["title"], subTitle: el?["subTitle"]));
});
InputType inputType =
InputType.values.firstWhere((e) => e.name == element?["inputType"]);
return QuestionStep(
inputType: inputType,
options: options,
footerBackButton: element?["footerBackButton"] ?? false,
selectionType: element?["selectionType"] != null
? SelectionType.values
.firstWhere((e) => e.name == element?["selectionType"])
: null,
filter: element?["filter"] ?? [],
lengthLimit: element?["lengthLimit"] ?? -1,
count: element?["count"] ?? 4,
disabled: element?["disabled"] ?? false,
maxHeight: element?["maxHeight"] ?? 600,
maxCount: element?["maxCount"] ?? 100,
mask: element?["mask"],
description: element?["description"],
textAlign: textAlignmentFromString(element?["textAlign"] ?? ""),
style: UIStyle.from(element?["style"]),
crossAxisAlignmentContent: crossAlignmentFromString(
element?["crossAxisAlignmentContent"] ?? "center") ??
CrossAxisAlignment.center,
display: element?["display"] != null
? Display.values.firstWhere((e) => e.name == element?["display"])
: Display.normal,
relevantConditions: relevantConditions,
cancellable: element?["cancellable"],
hint: element?["hint"],
label: element?["label"],
componentsStyle: element?["componentsStyle"] != null
? ComponentsStyle.values
.firstWhere((e) => e.name == element?["componentsStyle"])
: ComponentsStyle.minimal,
inputStyle: element?["inputStyle"] != null
? InputStyle.values
.firstWhere((e) => e.name == element?["inputStyle"])
: InputStyle.basic,
autoTrigger: element?["autoTrigger"] ?? false,
backButtonText: element?["backButtonText"],
cancelButtonText: element?["cancelButtonText"],
isOptional: element?["isOptional"],
nextButtonText: element?["nextButtonText"],
numberOfLines: element?["numberOfLines"],
text: element?["text"],
width: element?["width"],
title: element?["title"],
titleIconAnimationFile: element?["titleIconAnimationFile"],
titleIconMaxWidth: element?["titleIconMaxWidth"],
id: GenericIdentifier(id: element?["id"]));
}