SingleScanningMode.fromJson constructor

SingleScanningMode.fromJson(
  1. Map<String, dynamic> json
)

Implementation

factory SingleScanningMode.fromJson(Map<String, dynamic> json) =>
    SingleScanningMode(
      confirmationSheetEnabled: json.containsKey("confirmationSheetEnabled")
          ? (json["confirmationSheetEnabled"] as bool)
          : false,
      barcodeImageVisible: json.containsKey("barcodeImageVisible")
          ? (json["barcodeImageVisible"] as bool)
          : true,
      sheetColor: json.containsKey("sheetColor")
          ? ScanbotColor(json["sheetColor"] as String)
          : ScanbotColor("?sbColorSurface"),
      dividerColor: json.containsKey("dividerColor")
          ? ScanbotColor(json["dividerColor"] as String)
          : ScanbotColor("?sbColorOutline"),
      modalOverlayColor: json.containsKey("modalOverlayColor")
          ? ScanbotColor(json["modalOverlayColor"] as String)
          : ScanbotColor("?sbColorModalOverlay"),
      barcodeTitle: json.containsKey("barcodeTitle")
          ? StyledText.fromJson(json["barcodeTitle"] as Map<String, dynamic>)
          : StyledText(
              text: "BARCODE_TITLE",
              color: ScanbotColor("?sbColorOnSurface")),
      barcodeSubtitle: json.containsKey("barcodeSubtitle")
          ? StyledText.fromJson(
              json["barcodeSubtitle"] as Map<String, dynamic>)
          : StyledText(
              text: "BARCODE_SUBTITLE",
              color: ScanbotColor("?sbColorOnSurfaceVariant")),
      submitButton: json.containsKey("submitButton")
          ? ButtonConfiguration.fromJson(
              json["submitButton"] as Map<String, dynamic>)
          : ButtonConfiguration(
              visible: true,
              text: "?sheetSubmitButton",
              background: BackgroundStyle(
                  strokeColor: ScanbotColor("?sbColorPrimary"),
                  fillColor: ScanbotColor("?sbColorPrimary"),
                  strokeWidth: 1.0),
              foreground: ForegroundStyle(
                  iconVisible: true,
                  color: ScanbotColor("?sbColorOnPrimary"))),
      cancelButton: json.containsKey("cancelButton")
          ? ButtonConfiguration.fromJson(
              json["cancelButton"] as Map<String, dynamic>)
          : ButtonConfiguration(
              visible: true,
              text: "?singleModeConfirmationCancelButton",
              background: BackgroundStyle(
                  strokeColor: ScanbotColor("#00000000"),
                  fillColor: ScanbotColor("#00000000"),
                  strokeWidth: 1.0),
              foreground: ForegroundStyle(
                  iconVisible: false,
                  color: ScanbotColor("?sbColorPrimary"))),
      barcodeInfoMapping: json.containsKey("barcodeInfoMapping")
          ? BarcodeInfoMapping.fromJson(
              json["barcodeInfoMapping"] as Map<String, dynamic>)
          : BarcodeInfoMapping(
              sheetColor: ScanbotColor("?sbColorSurface"),
              dividerColor: ScanbotColor("?sbColorOutline"),
              modalOverlayColor: ScanbotColor("?sbColorModalOverlay"),
              loadingMessage: StyledText(
                  text: "?barcodeInfoMappingLoadingMessage",
                  color: ScanbotColor("?sbColorPrimary")),
              errorState: BarcodeItemErrorState(
                  title: StyledText(
                      text: "?barcodeInfoMappingErrorStateTitle",
                      color: ScanbotColor("?sbColorOnSurface")),
                  subtitle: StyledText(
                      text: "?barcodeInfoMappingErrorStateSubtitle",
                      color: ScanbotColor("?sbColorOnSurfaceVariant")),
                  retryButton: ButtonConfiguration(
                      visible: true,
                      text: "?barcodeInfoMappingErrorStateRetryButton",
                      background: BackgroundStyle(
                          strokeColor: ScanbotColor("?sbColorPrimary"),
                          fillColor: ScanbotColor("?sbColorPrimary"),
                          strokeWidth: 1.0),
                      foreground: ForegroundStyle(
                          iconVisible: true,
                          color: ScanbotColor("?sbColorOnPrimary"))),
                  cancelButton: ButtonConfiguration(
                      text: "?barcodeInfoMappingErrorStateCancelButton",
                      background: BackgroundStyle(
                          strokeColor: ScanbotColor("#00000000"),
                          fillColor: ScanbotColor("#00000000"),
                          strokeWidth: 1.0),
                      foreground: ForegroundStyle(
                          iconVisible: false,
                          color: ScanbotColor("?sbColorPrimary"))))),
      arOverlay: json.containsKey("arOverlay")
          ? ArOverlayGeneralConfiguration.fromJson(
              json["arOverlay"] as Map<String, dynamic>)
          : ArOverlayGeneralConfiguration(
              visible: false,
              counterBadge: BadgeStyle(
                  visible: true,
                  background: BackgroundStyle(
                      strokeColor: ScanbotColor("#000000FF"),
                      fillColor: ScanbotColor("?sbColorPositive"),
                      strokeWidth: 0.0),
                  foregroundColor: ScanbotColor("?sbColorOnSurface")),
              automaticSelectionEnabled: false,
              barcodeItemInfoPosition: BarcodeItemInfoPosition.BELOW,
              polygon: ArOverlayPolygonConfiguration(
                  visible: true,
                  deselected: PolygonStyle(
                      strokeColor: ScanbotColor("?sbColorSurface"),
                      fillColor: ScanbotColor("#00000000"),
                      strokeWidth: 3.0,
                      cornerRadius: 5.0),
                  selected: PolygonStyle(
                      strokeColor: ScanbotColor("?sbColorPositive"),
                      fillColor: ScanbotColor("#00000000"),
                      strokeWidth: 3.0,
                      cornerRadius: 5.0)),
              barcodeItemConfiguration: BarcodeItemConfiguration(
                  imageVisible: true,
                  titleSelected: StyledText(
                      text: "BARCODE_TITLE",
                      color: ScanbotColor("?sbColorOnSurface")),
                  subtitleSelected: StyledText(
                      text: "BARCODE_SUBTITLE",
                      color: ScanbotColor("?sbColorOnSurfaceVariant")),
                  titleDeselected: StyledText(
                      text: "BARCODE_TITLE",
                      color: ScanbotColor("?sbColorOnSurface")),
                  subtitleDeselected: StyledText(
                      visible: true,
                      text: "BARCODE_SUBTITLE",
                      color: ScanbotColor("?sbColorOnSurfaceVariant"),
                      useShadow: false),
                  backgroundSelected: PolygonStyle(
                      strokeColor: ScanbotColor("?sbColorPositive"),
                      fillColor: ScanbotColor("?sbColorPositive"),
                      strokeWidth: 1.0,
                      cornerRadius: 5.0),
                  backgroundDeselected: PolygonStyle(
                      strokeColor: ScanbotColor("?sbColorSurface"),
                      fillColor: ScanbotColor("?sbColorSurface"),
                      strokeWidth: 1.0,
                      cornerRadius: 5.0))),
    );