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: "Grant permission",
              background: BackgroundStyle(
                  strokeColor: ScanbotColor("?sbColorPrimary"),
                  fillColor: ScanbotColor("?sbColorPrimary"),
                  strokeWidth: 0.0),
              foreground: ForegroundStyle(
                  iconVisible: false,
                  color: ScanbotColor("?sbColorOnPrimary"),
                  useShadow: false)),
      closeButton: json.containsKey("closeButton")
          ? ButtonConfiguration.fromJson(
              json["closeButton"] as Map<String, dynamic>)
          : ButtonConfiguration(
              text: "Close",
              background: BackgroundStyle(
                  strokeColor: ScanbotColor("#00000000"),
                  fillColor: ScanbotColor("#00000000"),
                  strokeWidth: 0.0),
              foreground: ForegroundStyle(
                  iconVisible: false,
                  color: ScanbotColor("?sbColorPrimary"),
                  useShadow: false)),
      enableCameraTitle: json.containsKey("enableCameraTitle")
          ? StyledText.fromJson(
              json["enableCameraTitle"] as Map<String, dynamic>)
          : StyledText(
              text: "Camera permission denied!",
              color: ScanbotColor("?sbColorOnSurface")),
      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")),
    );