CameraPermissionScreen.fromJson constructor

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

Implementation

factory CameraPermissionScreen.fromJson(Map<String, dynamic> json) =>
    CameraPermissionScreen(
      statusBarMode: json.containsKey("statusBarMode")
          ? StatusBarMode.values.byName(json["statusBarMode"] as String)
          : StatusBarMode.DARK,
      background: json.containsKey("background")
          ? ScanbotColor(json["background"] as String)
          : ScanbotColor("?sbColorSurface"),
      iconBackground: json.containsKey("iconBackground")
          ? ScanbotColor(json["iconBackground"] as String)
          : ScanbotColor("?sbColorOutline"),
      icon: json.containsKey("icon")
          ? IconStyle.fromJson(json["icon"] as Map<String, dynamic>)
          : IconStyle(
              visible: true, color: ScanbotColor("?sbColorOnSurface")),
      enableCameraButton: json.containsKey("enableCameraButton")
          ? ButtonConfiguration.fromJson(
              json["enableCameraButton"] as Map<String, dynamic>)
          : ButtonConfiguration(
              text: "{'type': 'String', 'default': 'Grant permission'}",
              background: BackgroundStyle(),
              foreground: ForegroundStyle()),
      closeButton: json.containsKey("closeButton")
          ? ButtonConfiguration.fromJson(
              json["closeButton"] as Map<String, dynamic>)
          : ButtonConfiguration(
              text: "Close",
              background: BackgroundStyle(),
              foreground: ForegroundStyle()),
      enableCameraTitle: json.containsKey("enableCameraTitle")
          ? StyledText.fromJson(
              json["enableCameraTitle"] as Map<String, dynamic>)
          : StyledText(
              text: "Camera permission denied!",
              color: ScanbotColor("?colorOnSurface")),
      enableCameraExplanation: json.containsKey("enableCameraExplanation")
          ? StyledText.fromJson(
              json["enableCameraExplanation"] as Map<String, dynamic>)
          : StyledText(
              text:
                  "Please allow the usage of the camera to start the scanning process.",
              color: ScanbotColor("?sbColorOnSurfaceVariant")),
    );