SheetContent.fromJson constructor

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

Implementation

factory SheetContent.fromJson(Map<String, dynamic> json) => SheetContent(
      sheetColor: json.containsKey("sheetColor")
          ? ScanbotColor(json["sheetColor"] as String)
          : ScanbotColor("?sbColorSurface"),
      dividerColor: json.containsKey("dividerColor")
          ? ScanbotColor(json["dividerColor"] as String)
          : ScanbotColor("?sbColorOutline"),
      manualCountChangeEnabled: json.containsKey("manualCountChangeEnabled")
          ? (json["manualCountChangeEnabled"] as bool)
          : true,
      manualCountOutlineColor: json.containsKey("manualCountOutlineColor")
          ? ScanbotColor(json["manualCountOutlineColor"] as String)
          : ScanbotColor("?sbColorOutline"),
      manualCountChangeColor: json.containsKey("manualCountChangeColor")
          ? ScanbotColor(json["manualCountChangeColor"] as String)
          : ScanbotColor("?sbColorPrimary"),
      title: json.containsKey("title")
          ? StyledText.fromJson(json["title"] as Map<String, dynamic>)
          : StyledText(
              text: "%d items", color: ScanbotColor("?sbColorOnSurface")),
      clearAllButton: json.containsKey("clearAllButton")
          ? ButtonConfiguration.fromJson(
              json["clearAllButton"] as Map<String, dynamic>)
          : ButtonConfiguration(
              visible: true,
              text: "Clear all",
              background: BackgroundStyle(
                  strokeColor: ScanbotColor("#00000000"),
                  fillColor: ScanbotColor("#00000000"),
                  strokeWidth: 1.0),
              foreground: ForegroundStyle(
                  iconVisible: false,
                  color: ScanbotColor("?sbColorOnSurface"),
                  useShadow: false)),
      barcodeItemTitle: json.containsKey("barcodeItemTitle")
          ? StyledText.fromJson(
              json["barcodeItemTitle"] as Map<String, dynamic>)
          : StyledText(
              visible: true,
              text: "BARCODE_TITLE",
              color: ScanbotColor("?sbColorOnSurface"),
              useShadow: false),
      barcodeItemSubtitle: json.containsKey("barcodeItemSubtitle")
          ? StyledText.fromJson(
              json["barcodeItemSubtitle"] as Map<String, dynamic>)
          : StyledText(
              text: "BARCODE_SUBTITLE",
              color: ScanbotColor("?sbColorOnSurfaceVariant")),
      barcodeItemImageVisible: json.containsKey("barcodeItemImageVisible")
          ? (json["barcodeItemImageVisible"] as bool)
          : true,
      submitButton: json.containsKey("submitButton")
          ? ButtonConfiguration.fromJson(
              json["submitButton"] as Map<String, dynamic>)
          : ButtonConfiguration(
              visible: true,
              text: "Submit",
              background: BackgroundStyle(
                  strokeColor: ScanbotColor("#00000000"),
                  fillColor: ScanbotColor("#00000000"),
                  strokeWidth: 1.0),
              foreground: ForegroundStyle(
                  iconVisible: false,
                  color: ScanbotColor("?sbColorOnSurface"),
                  useShadow: false)),
      startScanningButton: json.containsKey("startScanningButton")
          ? ButtonConfiguration.fromJson(
              json["startScanningButton"] as Map<String, dynamic>)
          : ButtonConfiguration(
              visible: true,
              text: "Start scanning",
              background: BackgroundStyle(
                  strokeColor: ScanbotColor("?sbColorPrimary"),
                  fillColor: ScanbotColor("?sbColorPrimary"),
                  strokeWidth: 1.0),
              foreground: ForegroundStyle(
                  iconVisible: true,
                  color: ScanbotColor("?sbColorOnPrimary"),
                  useShadow: false)),
      placeholderTitle: json.containsKey("placeholderTitle")
          ? StyledText.fromJson(
              json["placeholderTitle"] as Map<String, dynamic>)
          : StyledText(
              text: "No barcodes here!",
              color: ScanbotColor("?sbColorOnSurface")),
      placeholderSubtitle: json.containsKey("placeholderSubtitle")
          ? StyledText.fromJson(
              json["placeholderSubtitle"] as Map<String, dynamic>)
          : StyledText(
              text:
                  "The barcode list is currently empty. Close this sheet and scan your items to add them.",
              color: ScanbotColor("?sbColorOnSurfaceVariant")),
      placeholderIconBackground: json.containsKey("placeholderIconBackground")
          ? ScanbotColor(json["placeholderIconBackground"] as String)
          : ScanbotColor("?sbColorOutline"),
      placeholderIcon: json.containsKey("placeholderIcon")
          ? IconStyle.fromJson(
              json["placeholderIcon"] as Map<String, dynamic>)
          : IconStyle(
              visible: true, color: ScanbotColor("?sbColorOnSurface")),
      swipeToDelete: json.containsKey("swipeToDelete")
          ? SwipeToDelete.fromJson(
              json["swipeToDelete"] as Map<String, dynamic>)
          : SwipeToDelete(
              enabled: true,
              backgroundColor: ScanbotColor("?sbColorNegative"),
              iconColor: ScanbotColor("?sbColorOnPrimary")),
    );