DocumentDataExtractorScreenConfiguration.fromJson constructor

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

Implementation

factory DocumentDataExtractorScreenConfiguration.fromJson(
        Map<String, dynamic> json) =>
    DocumentDataExtractorScreenConfiguration(
      version:
          json.containsKey("version") ? json["version"] as String : "1.0",
      screen: json.containsKey("screen")
          ? json["screen"] as String
          : "DocumentDataExtractor",
      localization: json.containsKey("localization")
          ? DocumentDataExtractorScreenTextLocalization.fromJson(
              json["localization"] as Map<String, dynamic>)
          : DocumentDataExtractorScreenTextLocalization(),
      palette: json.containsKey("palette")
          ? Palette.fromJson(json["palette"] as Map<String, dynamic>)
          : Palette(),
      backgroundColor: json.containsKey("backgroundColor")
          ? ScanbotColor(json["backgroundColor"] as String)
          : ScanbotColor("?sbColorSurfaceLow"),
      cameraConfiguration: json.containsKey("cameraConfiguration")
          ? CameraConfiguration.fromJson(
              json["cameraConfiguration"] as Map<String, dynamic>)
          : CameraConfiguration(
              orientationLockMode: OrientationLockMode.PORTRAIT),
      cameraPermission: json.containsKey("cameraPermission")
          ? CameraPermissionScreen.fromJson(
              json["cameraPermission"] as Map<String, dynamic>)
          : CameraPermissionScreen(
              statusBarMode: StatusBarMode.DARK,
              background: ScanbotColor("?sbColorSurface"),
              iconBackground: ScanbotColor("?sbColorOutline"),
              icon: IconStyle(
                  visible: true, color: ScanbotColor("?sbColorOnSurface")),
              enableCameraButton: ButtonConfiguration(
                  visible: true,
                  text: "?cameraPermissionEnableCameraButton",
                  accessibilityDescription:
                      "?accessibilityDescriptionCameraPermissionEnableCameraButton",
                  background: BackgroundStyle(
                      strokeColor: ScanbotColor("?sbColorPrimary"),
                      fillColor: ScanbotColor("?sbColorPrimary"),
                      strokeWidth: 0.0),
                  foreground: ForegroundStyle(
                      iconVisible: false,
                      color: ScanbotColor("?sbColorOnPrimary"),
                      useShadow: false)),
              closeButton: ButtonConfiguration(
                  visible: true,
                  text: "?cameraPermissionCloseButton",
                  accessibilityDescription:
                      "?accessibilityDescriptionCameraPermissionCloseButton",
                  background: BackgroundStyle(
                      strokeColor: ScanbotColor("#00000000"),
                      fillColor: ScanbotColor("#00000000"),
                      strokeWidth: 0.0),
                  foreground: ForegroundStyle(
                      iconVisible: false,
                      color: ScanbotColor("?sbColorPrimary"),
                      useShadow: false)),
              enableCameraTitle: StyledText(
                  text: "?cameraPermissionEnableCameraTitle",
                  color: ScanbotColor("?sbColorOnSurface")),
              enableCameraExplanation: StyledText(
                  text: "?cameraPermissionEnableCameraExplanation",
                  color: ScanbotColor("?sbColorOnSurfaceVariant"))),
      topUserGuidance: json.containsKey("topUserGuidance")
          ? UserGuidanceConfiguration.fromJson(
              json["topUserGuidance"] as Map<String, dynamic>)
          : UserGuidanceConfiguration(
              title: StyledText(text: "?topUserGuidance")),
      scanStatusUserGuidance: json.containsKey("scanStatusUserGuidance")
          ? DocumentDataExtractorGuidanceConfiguration.fromJson(
              json["scanStatusUserGuidance"] as Map<String, dynamic>)
          : DocumentDataExtractorGuidanceConfiguration(),
      topBar: json.containsKey("topBar")
          ? TopBarConfiguration.fromJson(
              json["topBar"] as Map<String, dynamic>)
          : TopBarConfiguration(
              title: StyledText(visible: true, text: "?topBarTitle"),
              cancelButton: ButtonConfiguration(
                  text: "?topBarCancelButton",
                  accessibilityDescription:
                      "?accessibilityDescriptionCancelButton",
                  background: BackgroundStyle(
                      strokeColor: ScanbotColor("#00000000"),
                      fillColor: ScanbotColor("#00000000"),
                      strokeWidth: 0.0),
                  foreground: ForegroundStyle(
                      color: ScanbotColor("?sbColorOnPrimary")))),
      topBarOpenIntroScreenButton:
          json.containsKey("topBarOpenIntroScreenButton")
              ? ScanbotIconButton.fromJson(
                  json["topBarOpenIntroScreenButton"] as Map<String, dynamic>)
              : ScanbotIconButton(
                  color: ScanbotColor("?sbColorOnPrimary"),
                  accessibilityDescription:
                      "?accessibilityDescriptionOpenIntroScreenButton"),
      introScreen: json.containsKey("introScreen")
          ? DocumentDataExtractorIntroScreenConfiguration.fromJson(
              json["introScreen"] as Map<String, dynamic>)
          : DocumentDataExtractorIntroScreenConfiguration(),
      actionBar: json.containsKey("actionBar")
          ? ActionBarConfiguration.fromJson(
              json["actionBar"] as Map<String, dynamic>)
          : ActionBarConfiguration(
              flipCameraButton: RoundButton(
                  visible: false,
                  accessibilityDescription:
                      "?accessibilityDescriptionFlipCameraButton",
                  backgroundColor: ScanbotColor("?sbColorSurfaceHigh"),
                  foregroundColor: ScanbotColor("?sbColorOnPrimary"),
                  activeBackgroundColor: ScanbotColor("?sbColorWarning"),
                  activeForegroundColor: ScanbotColor("#1C1B1F"))),
      viewFinder: json.containsKey("viewFinder")
          ? PermanentViewFinderConfiguration.fromJson(
              json["viewFinder"] as Map<String, dynamic>)
          : PermanentViewFinderConfiguration(
              style: FinderCorneredStyle(
                  strokeColor: ScanbotColor("?sbColorSurface"),
                  strokeWidth: 2.0),
              aspectRatio: AspectRatio(width: 3.0, height: 2.0),
              minimumInsets: ScanbotEdgeInsets(
                  top: 24.0, left: 24.0, bottom: 24.0, right: 24.0)),
      scannerConfiguration: json.containsKey("scannerConfiguration")
          ? DocumentDataExtractorConfiguration.fromJson(
              json["scannerConfiguration"] as Map<String, dynamic>)
          : DocumentDataExtractorConfiguration(),
      extractionProgress: json.containsKey("extractionProgress")
          ? DocumentDataExtractionProgressConfiguration.fromJson(
              json["extractionProgress"] as Map<String, dynamic>)
          : DocumentDataExtractionProgressConfiguration(),
      noDocumentFoundTimeout: json.containsKey("noDocumentFoundTimeout")
          ? (json["noDocumentFoundTimeout"] as int)
          : 5000,
      accumulationTimeout: json.containsKey("accumulationTimeout")
          ? (json["accumulationTimeout"] as int)
          : 3000,
      successOverlay: json.containsKey("successOverlay")
          ? ScanCompletionOverlay.fromJson(
              json["successOverlay"] as Map<String, dynamic>)
          : ScanCompletionOverlay(),
      noDocumentDetectedAlertDialog: json
              .containsKey("noDocumentDetectedAlertDialog")
          ? ScanbotAlertDialog.fromJson(
              json["noDocumentDetectedAlertDialog"] as Map<String, dynamic>)
          : ScanbotAlertDialog(
              title: StyledText(
                  text: "?documentDataExtractorNoDocumentDetectedAlertTitle",
                  color: ScanbotColor("?sbColorOnSurface")),
              subtitle: StyledText(
                  text:
                      "?documentDataExtractorNoDocumentDetectedAlertSubtitle",
                  color: ScanbotColor("?sbColorOnSurfaceVariant")),
              sheetColor: ScanbotColor("?sbColorSurface"),
              modalOverlayColor: ScanbotColor("?sbColorModalOverlay"),
              dividerColor: ScanbotColor("?sbColorOutline"),
              okButton: ButtonConfiguration(
                  visible: true,
                  text: "?documentDataExtractorAlertRetryButton",
                  accessibilityDescription:
                      "?accessibilityDescriptionRetryButton",
                  background: BackgroundStyle(
                      strokeColor: ScanbotColor("?sbColorPrimary"),
                      fillColor: ScanbotColor("?sbColorPrimary"),
                      strokeWidth: 1.0),
                  foreground: ForegroundStyle(
                      iconVisible: true,
                      color: ScanbotColor("?sbColorOnPrimary"),
                      useShadow: false)),
              cancelButton: ButtonConfiguration(
                  visible: true,
                  text: "?documentDataExtractorAlertCloseScannerButton",
                  accessibilityDescription:
                      "?accessibilityDescriptionCloseScannerButton",
                  background: BackgroundStyle(
                      strokeColor: ScanbotColor("#00000000"),
                      fillColor: ScanbotColor("#00000000"),
                      strokeWidth: 1.0),
                  foreground: ForegroundStyle(
                      iconVisible: false,
                      color: ScanbotColor("?sbColorPrimary"),
                      useShadow: false))),
      cantProcessDocumentAlertDialog: json
              .containsKey("cantProcessDocumentAlertDialog")
          ? ScanbotAlertDialog.fromJson(
              json["cantProcessDocumentAlertDialog"] as Map<String, dynamic>)
          : ScanbotAlertDialog(
              title: StyledText(
                  text: "?documentDataExtractorCantProcessDocumentAlertTitle",
                  color: ScanbotColor("?sbColorOnSurface")),
              subtitle: StyledText(
                  text:
                      "?documentDataExtractorCantProcessDocumentAlertSubtitle",
                  color: ScanbotColor("?sbColorOnSurfaceVariant")),
              sheetColor: ScanbotColor("?sbColorSurface"),
              modalOverlayColor: ScanbotColor("?sbColorModalOverlay"),
              dividerColor: ScanbotColor("?sbColorOutline"),
              okButton: ButtonConfiguration(
                  visible: true,
                  text: "?documentDataExtractorAlertRetryButton",
                  accessibilityDescription:
                      "?accessibilityDescriptionRetryButton",
                  background: BackgroundStyle(
                      strokeColor: ScanbotColor("?sbColorPrimary"),
                      fillColor: ScanbotColor("?sbColorPrimary"),
                      strokeWidth: 1.0),
                  foreground: ForegroundStyle(
                      iconVisible: true,
                      color: ScanbotColor("?sbColorOnPrimary"),
                      useShadow: false)),
              cancelButton: ButtonConfiguration(
                  visible: true,
                  text: "?documentDataExtractorAlertCloseScannerButton",
                  accessibilityDescription:
                      "?accessibilityDescriptionCloseScannerButton",
                  background: BackgroundStyle(
                      strokeColor: ScanbotColor("#00000000"),
                      fillColor: ScanbotColor("#00000000"),
                      strokeWidth: 1.0),
                  foreground: ForegroundStyle(
                      iconVisible: false,
                      color: ScanbotColor("?sbColorPrimary"),
                      useShadow: false))),
      unsupportedDocumentAlertDialog: json
              .containsKey("unsupportedDocumentAlertDialog")
          ? ScanbotAlertDialog.fromJson(
              json["unsupportedDocumentAlertDialog"] as Map<String, dynamic>)
          : ScanbotAlertDialog(
              title: StyledText(
                  text: "?documentDataExtractorUnsupportedDocumentAlertTitle",
                  color: ScanbotColor("?sbColorOnSurface")),
              subtitle: StyledText(
                  text:
                      "?documentDataExtractorUnsupportedDocumentAlertSubtitle",
                  color: ScanbotColor("?sbColorOnSurfaceVariant")),
              sheetColor: ScanbotColor("?sbColorSurface"),
              modalOverlayColor: ScanbotColor("?sbColorModalOverlay"),
              dividerColor: ScanbotColor("?sbColorOutline"),
              okButton: ButtonConfiguration(
                  visible: true,
                  text: "?documentDataExtractorAlertRetryButton",
                  accessibilityDescription:
                      "?accessibilityDescriptionRetryButton",
                  background: BackgroundStyle(
                      strokeColor: ScanbotColor("?sbColorPrimary"),
                      fillColor: ScanbotColor("?sbColorPrimary"),
                      strokeWidth: 1.0),
                  foreground: ForegroundStyle(
                      iconVisible: true,
                      color: ScanbotColor("?sbColorOnPrimary"),
                      useShadow: false)),
              cancelButton: ButtonConfiguration(
                  visible: true,
                  text: "?documentDataExtractorAlertCloseScannerButton",
                  accessibilityDescription:
                      "?accessibilityDescriptionCloseScannerButton",
                  background: BackgroundStyle(
                      strokeColor: ScanbotColor("#00000000"),
                      fillColor: ScanbotColor("#00000000"),
                      strokeWidth: 1.0),
                  foreground: ForegroundStyle(
                      iconVisible: false,
                      color: ScanbotColor("?sbColorPrimary"),
                      useShadow: false))),
      scanningTooLongAlertDialog: json
              .containsKey("scanningTooLongAlertDialog")
          ? ScanbotAlertDialog.fromJson(
              json["scanningTooLongAlertDialog"] as Map<String, dynamic>)
          : ScanbotAlertDialog(
              title: StyledText(
                  text: "?documentDataExtractorScanningTooLongAlertTitle",
                  color: ScanbotColor("?sbColorOnSurface")),
              subtitle: StyledText(
                  text: "?documentDataExtractorScanningTooLongAlertSubtitle",
                  color: ScanbotColor("?sbColorOnSurfaceVariant")),
              sheetColor: ScanbotColor("?sbColorSurface"),
              modalOverlayColor: ScanbotColor("?sbColorModalOverlay"),
              dividerColor: ScanbotColor("?sbColorOutline"),
              okButton: ButtonConfiguration(
                  visible: true,
                  text: "?documentDataExtractorAlertRetryButton",
                  accessibilityDescription:
                      "?accessibilityDescriptionRetButton",
                  background: BackgroundStyle(
                      strokeColor: ScanbotColor("?sbColorPrimary"),
                      fillColor: ScanbotColor("?sbColorPrimary"),
                      strokeWidth: 1.0),
                  foreground: ForegroundStyle(
                      iconVisible: true,
                      color: ScanbotColor("?sbColorOnPrimary"),
                      useShadow: false)),
              cancelButton: ButtonConfiguration(
                  visible: true,
                  text: "?documentDataExtractorAlertCloseScannerButton",
                  accessibilityDescription:
                      "?accessibilityDescriptionCloseScannerButton",
                  background: BackgroundStyle(
                      strokeColor: ScanbotColor("#00000000"),
                      fillColor: ScanbotColor("#00000000"),
                      strokeWidth: 1.0),
                  foreground: ForegroundStyle(
                      iconVisible: false,
                      color: ScanbotColor("?sbColorPrimary"),
                      useShadow: false))),
      sound: json.containsKey("sound")
          ? Sound.fromJson(json["sound"] as Map<String, dynamic>)
          : Sound(),
      vibration: json.containsKey("vibration")
          ? Vibration.fromJson(json["vibration"] as Map<String, dynamic>)
          : Vibration(),
      keepScreenOn: json.containsKey("keepScreenOn")
          ? (json["keepScreenOn"] as bool)
          : true,
    );