BarcodeScannerConfiguration.fromJson constructor

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

Implementation

factory BarcodeScannerConfiguration.fromJson(Map<String, dynamic> json) =>
    BarcodeScannerConfiguration(
      version:
          json.containsKey("version") ? json["version"] as String : "1.0",
      screen: json.containsKey("screen")
          ? json["screen"] as String
          : "BarcodeScanner",
      palette: json.containsKey("palette")
          ? Palette.fromJson(json["palette"] as Map<String, dynamic>)
          : Palette(
              sbColorPrimary: ScanbotColor("#C8193C"),
              sbColorPrimaryDisabled: ScanbotColor("#F5F5F5"),
              sbColorNegative: ScanbotColor("#FF3737"),
              sbColorPositive: ScanbotColor("#4EFFB4"),
              sbColorWarning: ScanbotColor("#FFCE5C"),
              sbColorSecondary: ScanbotColor("#FFEDEE"),
              sbColorSecondaryDisabled: ScanbotColor("#F5F5F5"),
              sbColorOnPrimary: ScanbotColor("#FFFFFF"),
              sbColorOnSecondary: ScanbotColor("#C8193C"),
              sbColorSurface: ScanbotColor("#FFFFFF"),
              sbColorOutline: ScanbotColor("#EFEFEF"),
              sbColorOnSurfaceVariant: ScanbotColor("#707070"),
              sbColorOnSurface: ScanbotColor("#000000"),
              sbColorSurfaceLow: ScanbotColor("#00000026"),
              sbColorSurfaceHigh: ScanbotColor("#0000007A"),
              sbColorModalOverlay: ScanbotColor("#000000A3")),
      localization: json.containsKey("localization")
          ? BarcodeTextLocalization.fromJson(
              json["localization"] as Map<String, dynamic>)
          : BarcodeTextLocalization(),
      backgroundColor: json.containsKey("backgroundColor")
          ? ScanbotColor(json["backgroundColor"] as String)
          : ScanbotColor("?sbColorSurfaceLow"),
      topBar: json.containsKey("topBar")
          ? TopBarConfiguration.fromJson(
              json["topBar"] as Map<String, dynamic>)
          : TopBarConfiguration(
              title: StyledText(
                  text: "?topBarTitle",
                  color: ScanbotColor("?sbColorOnPrimary")),
              mode: TopBarMode.SOLID,
              statusBarMode: StatusBarMode.LIGHT,
              backgroundColor: ScanbotColor("?sbColorPrimary"),
              cancelButton: ButtonConfiguration(
                  visible: true,
                  text: "?topBarCancelButton",
                  background: BackgroundStyle(
                      strokeColor: ScanbotColor("#00000000"),
                      fillColor: ScanbotColor("#00000000"),
                      strokeWidth: 0.0),
                  foreground: ForegroundStyle(
                      iconVisible: true,
                      color: ScanbotColor("?sbColorOnPrimary"),
                      useShadow: false))),
      actionBar: json.containsKey("actionBar")
          ? ActionBarConfiguration.fromJson(
              json["actionBar"] as Map<String, dynamic>)
          : ActionBarConfiguration(
              flashButton: RoundButton(
                  visible: true,
                  backgroundColor: ScanbotColor("?sbColorSurfaceHigh"),
                  foregroundColor: ScanbotColor("?sbColorOnPrimary"),
                  activeBackgroundColor: ScanbotColor("?sbColorWarning"),
                  activeForegroundColor: ScanbotColor("#1C1B1F")),
              zoomButton: RoundButton(
                  visible: true,
                  backgroundColor: ScanbotColor("?sbColorSurfaceHigh"),
                  foregroundColor: ScanbotColor("?sbColorOnPrimary"),
                  activeBackgroundColor: ScanbotColor("?sbColorSurfaceHigh"),
                  activeForegroundColor: ScanbotColor("?sbColorOnPrimary")),
              flipCameraButton: RoundButton(
                  visible: true,
                  backgroundColor: ScanbotColor("?sbColorSurfaceHigh"),
                  foregroundColor: ScanbotColor("?sbColorOnPrimary"),
                  activeBackgroundColor: ScanbotColor("?sbColorSurfaceHigh"),
                  activeForegroundColor: ScanbotColor("?sbColorOnPrimary"))),
      viewFinder: json.containsKey("viewFinder")
          ? ViewFinderConfiguration.fromJson(
              json["viewFinder"] as Map<String, dynamic>)
          : ViewFinderConfiguration(
              visible: true,
              style: FinderCorneredStyle(
                  strokeColor: ScanbotColor("?sbColorSurface"),
                  strokeWidth: 2.0,
                  cornerRadius: 10.0),
              overlayColor: ScanbotColor("?sbColorSurfaceLow"),
              aspectRatio: AspectRatio(width: 1.0, height: 1.0)),
      userGuidance: json.containsKey("userGuidance")
          ? UserGuidanceConfiguration.fromJson(
              json["userGuidance"] as Map<String, dynamic>)
          : UserGuidanceConfiguration(
              visible: true,
              title: StyledText(
                  text: "?userGuidance",
                  color: ScanbotColor("?sbColorOnPrimary")),
              background: BackgroundStyle(
                  strokeColor: ScanbotColor("#00000000"),
                  fillColor: ScanbotColor("?sbColorSurfaceLow"),
                  strokeWidth: 0.0)),
      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",
                  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",
                  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"))),
      cameraConfiguration: json.containsKey("cameraConfiguration")
          ? CameraConfiguration.fromJson(
              json["cameraConfiguration"] as Map<String, dynamic>)
          : CameraConfiguration(),
      recognizerConfiguration: json.containsKey("recognizerConfiguration")
          ? BarcodeRecognizerConfiguration.fromJson(
              json["recognizerConfiguration"] as Map<String, dynamic>)
          : BarcodeRecognizerConfiguration(),
      useCase: json.containsKey("useCase")
          ? BarcodeUseCase.fromJson(json["useCase"] as Map<String, dynamic>)
          : SingleScanningMode(),
      sound: json.containsKey("sound")
          ? Sound.fromJson(json["sound"] as Map<String, dynamic>)
          : Sound(successBeepEnabled: true, soundType: SoundType.MODERN_BEEP),
      vibration: json.containsKey("vibration")
          ? Vibration.fromJson(json["vibration"] as Map<String, dynamic>)
          : Vibration(enabled: true),
      timeouts: json.containsKey("timeouts")
          ? Timeouts.fromJson(json["timeouts"] as Map<String, dynamic>)
          : Timeouts(autoCancelTimeout: 0, initialScanDelay: 0),
    );