setAppearance method
Implementation
void setAppearance(Map<String, dynamic> responseJson, String screen) {
if (responseJson.isNotEmpty) {
if (responseJson["appearance"] != null) {
String tposition = responseJson["appearance"]?["position"];
switch (tposition) {
case "top_full":
position.value = "top";
break;
case "center_center":
position.value = "center";
break;
case "bottom_full":
position.value = "bottom";
break;
default:
}
isCloseButtonEnabled.value = responseJson["appearance"]?["closeButton"];
closeButtonStyle.value =
responseJson["appearance"]?["colors"]?["overrides"] ?? {};
Map<String, dynamic> cardProp =
responseJson["appearance"]?["cardProperties"];
var mxHeight = double.parse(cardProp["maxHeight"].toString());
maxHeight.value = mxHeight / 100;
isFullScreenMode.value =
responseJson["appearance"]?["mode"] as String == "fullScreen"
? true
: false;
isBannerImageOn.value =
responseJson["appearance"]?["bannerImage"]?["enabled"];
}
spotcheckID.value = responseJson["spotCheckId"] ?? responseJson["id"];
spotcheckContactID.value = responseJson["spotCheckContactId"] ??
responseJson["spotCheckContact"]?["id"];
triggerToken.value = responseJson["triggerToken"] ?? "";
spotcheckURL.value =
"https://$domainName/n/spotcheck/${triggerToken.value}?spotcheckContactId=${spotcheckContactID.value}&traceId=${traceId.value}&spotcheckUrl=$screen";
variables.forEach((key, value) =>
spotcheckURL.value = "${spotcheckURL.value}&$key=$value");
if (Platform.isAndroid) {
spotcheckURL.value = "${spotcheckURL.value}&isAndroidMobileTarget=true";
}
if (sparrowLang.isNotEmpty) {
spotcheckURL.value = "${spotcheckURL.value}&sparrowLang=$sparrowLang";
}
log(spotcheckURL.value);
}
}