From c9242cf39683b83f978323f5ed95a999bf517c49 Mon Sep 17 00:00:00 2001
From: PACMAN <ijyk3061@gmail.com>
Date: Thu, 11 Nov 2021 19:36:35 +0900
Subject: [PATCH 01/15] stash add figma gradient docs

---
 docs/figma-gradient.md                        | 48 +++++++++++++++++++
 .../designto-token/token-gradient/gradient.ts |  6 +--
 2 files changed, 51 insertions(+), 3 deletions(-)
 create mode 100644 docs/figma-gradient.md

diff --git a/docs/figma-gradient.md b/docs/figma-gradient.md
new file mode 100644
index 00000000..ba50cb3b
--- /dev/null
+++ b/docs/figma-gradient.md
@@ -0,0 +1,48 @@
+# Figma Gradient
+
+- [figma paint - gradient paint](https://www.figma.com/plugin-docs/api/Paint/#gradientpaint)
+- [css gradient](https://developer.mozilla.org/en-US/docs/Web/CSS/gradient)
+
+## gradient type
+
+- linear gradient
+- radial gradient
+- angular gradient
+- diamond gradient
+
+### linear gradient
+
+**css**
+
+- [linear-gradient()](<https://developer.mozilla.org/en-US/docs/Web/CSS/gradient/linear-gradient())
+
+`linear-gradient()` css function
+
+```css
+background: linear-gradient(45deg, blue, red);
+```
+
+> **syntax**
+> wip
+
+**flutter**
+
+- [LinearGradient()](https://api.flutter.dev/flutter/painting/LinearGradient-class.html)
+
+### radial gradient
+
+**css**
+
+- [radial-gradient()](<https://developer.mozilla.org/en-US/docs/Web/CSS/gradient/radial-gradient()>)
+
+```css
+background: radial-gradient(red, blue);
+```
+
+**flutter**
+
+- [RadialGradient()](https://api.flutter.dev/flutter/painting/RadialGradient-class.html)
+
+## gradient paint opacity
+
+gradient color's opacity \* fill's opacity
diff --git a/packages/designto-token/token-gradient/gradient.ts b/packages/designto-token/token-gradient/gradient.ts
index 7ff59262..d783589d 100644
--- a/packages/designto-token/token-gradient/gradient.ts
+++ b/packages/designto-token/token-gradient/gradient.ts
@@ -46,15 +46,15 @@ export function tokenize_gradient(
       });
     case "GRADIENT_RADIAL":
       console.error("GRADIENT_RADIAL not handled");
-      // TODO
+      // TODO:
       break;
     case "GRADIENT_ANGULAR":
       console.error("GRADIENT_ANGULAR not handled");
-      // TODO
+      // TODO:
       break;
     case "GRADIENT_DIAMOND":
       console.error("GRADIENT_DIAMOND not handled");
-      // TODO
+      // TODO:
       break;
   }
 }

From 62282cd269c5d65dc83dcc77a941f6d5aad9c2f8 Mon Sep 17 00:00:00 2001
From: PACMAN <ijyk3061@gmail.com>
Date: Fri, 12 Nov 2021 16:44:23 +0900
Subject: [PATCH 02/15] stash support radial gradient

---
 docs/figma-gradient.md                        | 10 ++++++---
 externals/reflect-core                        |  2 +-
 .../builder-css-styles/background/index.ts    |  8 ++++++-
 .../radial-gradient/index.ts                  | 21 +++++++++++++++++++
 .../designto-token/token-gradient/gradient.ts | 19 ++++++++++-------
 5 files changed, 48 insertions(+), 12 deletions(-)
 create mode 100644 packages/builder-css-styles/radial-gradient/index.ts

diff --git a/docs/figma-gradient.md b/docs/figma-gradient.md
index ba50cb3b..6fef3332 100644
--- a/docs/figma-gradient.md
+++ b/docs/figma-gradient.md
@@ -14,7 +14,7 @@
 
 **css**
 
-- [linear-gradient()](<https://developer.mozilla.org/en-US/docs/Web/CSS/gradient/linear-gradient())
+- [linear-gradient()](<https://developer.mozilla.org/en-US/docs/Web/CSS/gradient/linear-gradient()>)
 
 `linear-gradient()` css function
 
@@ -23,6 +23,7 @@ background: linear-gradient(45deg, blue, red);
 ```
 
 > **syntax**
+>
 > wip
 
 **flutter**
@@ -43,6 +44,9 @@ background: radial-gradient(red, blue);
 
 - [RadialGradient()](https://api.flutter.dev/flutter/painting/RadialGradient-class.html)
 
-## gradient paint opacity
+> **gradient paint opacity**
+>
+> gradient color's opacity \* fill's opacity
 
-gradient color's opacity \* fill's opacity
+> **gradient paint degree**
+> WIP
diff --git a/externals/reflect-core b/externals/reflect-core
index dde6fca1..ee83a6f2 160000
--- a/externals/reflect-core
+++ b/externals/reflect-core
@@ -1 +1 @@
-Subproject commit dde6fca1a062fa0c4ed8e331d3c28c2a76c0e8fd
+Subproject commit ee83a6f27f73559138e56faaebb9567b694a617d
diff --git a/packages/builder-css-styles/background/index.ts b/packages/builder-css-styles/background/index.ts
index 04f029c2..6275e36d 100644
--- a/packages/builder-css-styles/background/index.ts
+++ b/packages/builder-css-styles/background/index.ts
@@ -7,6 +7,7 @@ import { color } from "../color";
 import { array } from "@reflect-ui/uiutils";
 import { Color, GradientType } from "@reflect-ui/core";
 import { linearGradient } from "../linear-gradient";
+import { radialGradient } from "../radial-gradient";
 
 /**
  * @todo - not implemented
@@ -29,9 +30,14 @@ export function background(bg: Background): CSSProperties {
               background: linearGradient(_primary),
             };
           }
+          case GradientType.RADIAL: {
+            return {
+              background: radialGradient(_primary),
+            };
+          }
           default:
             console.error(
-              "other than linear-gradient is not supported yet.",
+              "other than linear, radial gradient is not supported yet.",
               _primary
             );
         }
diff --git a/packages/builder-css-styles/radial-gradient/index.ts b/packages/builder-css-styles/radial-gradient/index.ts
new file mode 100644
index 00000000..51f76321
--- /dev/null
+++ b/packages/builder-css-styles/radial-gradient/index.ts
@@ -0,0 +1,21 @@
+import { RadialGradientManifest } from "@reflect-ui/core";
+import { CSSProperty } from "@coli.codes/css";
+import { color } from "../color";
+
+/**
+ * https://developer.mozilla.org/en-US/docs/Web/CSS/gradient/radial-gradient()
+ *
+ * @param g
+ * @returns
+ */
+export function radialGradient(g: RadialGradientManifest): CSSProperty.Color {
+  // throw "css gradient not ready";
+  // TODO:
+  // 1. stops support
+  // 2. angle support
+  var angleDeg =
+    (Math.atan2(g.begin.y - g.end.y, g.begin.x - g.end.x) * 180) / Math.PI;
+
+  const colors = g.colors.map(color).join(", ");
+  return `radial-gradient(${colors})`;
+}
diff --git a/packages/designto-token/token-gradient/gradient.ts b/packages/designto-token/token-gradient/gradient.ts
index d783589d..e9823687 100644
--- a/packages/designto-token/token-gradient/gradient.ts
+++ b/packages/designto-token/token-gradient/gradient.ts
@@ -1,13 +1,12 @@
 import { Figma } from "@design-sdk/figma-types";
-import { Color, LinearGradient } from "@reflect-ui/core";
+import { Color, LinearGradient, Gradient } from "@reflect-ui/core";
 import { color_utils } from "@design-sdk/core";
 import { tokenize_gradient_direction_from_angle } from "../token-gradient";
 import { roundNumber } from "@reflect-ui/uiutils";
+import { RadialGradient } from "@reflect-ui/core/lib/radial-gradient";
 
-export function tokenize_gradient(
-  gradient: Figma.GradientPaint
-): LinearGradient {
-  // TODO Handle transform percisely.
+export function tokenize_gradient(gradient: Figma.GradientPaint): Gradient {
+  // TODO: Handle transform percisely.
   // https://www.figma.com/plugin-docs/api/Transform/
   // https://www.mathworks.com/discovery/affine-transformation.html
   const direction = tokenize_gradient_direction_from_angle(
@@ -45,9 +44,15 @@ export function tokenize_gradient(
         stops: stopPoints,
       });
     case "GRADIENT_RADIAL":
+      return new RadialGradient({
+        begin: direction.begin,
+        end: direction.end,
+        colors: colors,
+        stops: stopPoints,
+      });
+
       console.error("GRADIENT_RADIAL not handled");
-      // TODO:
-      break;
+    // TODO:
     case "GRADIENT_ANGULAR":
       console.error("GRADIENT_ANGULAR not handled");
       // TODO:

From 9fdc8b43ab99b2fc337267a99cab7fdd72f528b1 Mon Sep 17 00:00:00 2001
From: PACMAN <ijyk3061@gmail.com>
Date: Fri, 12 Nov 2021 17:47:06 +0900
Subject: [PATCH 03/15] fix boxshadow parameter handle to array

---
 packages/builder-web-core/widgets-native/container/index.ts | 2 +-
 packages/builder-web-core/widgets-native/flex/index.ts      | 2 +-
 packages/builder-web-core/widgets-native/stack/index.ts     | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/packages/builder-web-core/widgets-native/container/index.ts b/packages/builder-web-core/widgets-native/container/index.ts
index 4dd3ddf5..26755c90 100644
--- a/packages/builder-web-core/widgets-native/container/index.ts
+++ b/packages/builder-web-core/widgets-native/container/index.ts
@@ -43,7 +43,7 @@ export class Container extends StylableJsxWidget {
     return {
       width: css.px(this.width),
       height: css.px(this.height),
-      "box-shadow": css.boxshadow(...this.boxShadow),
+      "box-shadow": css.boxshadow(...(this.boxShadow ?? [])),
       ...css.background(this.background),
       ...css.border(this.border),
       ...css.borderRadius(this.borderRadius),
diff --git a/packages/builder-web-core/widgets-native/flex/index.ts b/packages/builder-web-core/widgets-native/flex/index.ts
index 39a1395b..54aea003 100644
--- a/packages/builder-web-core/widgets-native/flex/index.ts
+++ b/packages/builder-web-core/widgets-native/flex/index.ts
@@ -115,7 +115,7 @@ export class Flex extends MultiChildWidget implements CssMinHeightMixin {
       flex: this.flex,
       "flex-wrap": this.flexWrap,
       gap: this.itemSpacing && css.px(this.itemSpacing),
-      "box-shadow": css.boxshadow(...this.boxShadow),
+      "box-shadow": css.boxshadow(...(this.boxShadow ?? [])),
       ...css.border(this.border),
       ...css.borderRadius(this.borderRadius),
       ...flexsizing({ ...this }),
diff --git a/packages/builder-web-core/widgets-native/stack/index.ts b/packages/builder-web-core/widgets-native/stack/index.ts
index f4e3bf74..36c384e2 100644
--- a/packages/builder-web-core/widgets-native/stack/index.ts
+++ b/packages/builder-web-core/widgets-native/stack/index.ts
@@ -74,7 +74,7 @@ export class Stack extends MultiChildWidget implements CssMinHeightMixin {
       // for stacking elements under parent, parent's position shall be relative, children shall be absolute with anchor (e.g. bottom: 0)
       // can it be always relative?
       position: "relative",
-      "box-shadow": css.boxshadow(...this.boxShadow),
+      "box-shadow": css.boxshadow(...(this.boxShadow ?? [])),
     };
   }
 }

From 2aebf97ca18af66416b4b92f1dfad361c3529af5 Mon Sep 17 00:00:00 2001
From: PACMAN <ijyk3061@gmail.com>
Date: Sat, 13 Nov 2021 04:06:03 +0900
Subject: [PATCH 04/15] support radialGradient, linearGradient in flutter code

---
 .../make/make-flutter-box-decoration.ts       | 10 ++++---
 packages/designto-flutter/painting/index.ts   |  1 +
 .../painting/painting-box-decoration.ts       | 26 ++++++++++++++++---
 .../painting/painting-radial-gradient.ts      | 12 +++++++++
 .../tokens-to-flutter-widget/index.ts         |  4 +--
 .../designto-token/token-gradient/gradient.ts |  8 ++++--
 6 files changed, 51 insertions(+), 10 deletions(-)
 create mode 100644 packages/designto-flutter/painting/painting-radial-gradient.ts

diff --git a/packages/designto-flutter/make/make-flutter-box-decoration.ts b/packages/designto-flutter/make/make-flutter-box-decoration.ts
index 2b60aca1..38cb6870 100644
--- a/packages/designto-flutter/make/make-flutter-box-decoration.ts
+++ b/packages/designto-flutter/make/make-flutter-box-decoration.ts
@@ -6,6 +6,7 @@ import { interpretImageFill } from "../interpreter/image.interpret";
 import * as painting from "../painting";
 import { makeColorFromRGBO } from "./make-flutter-color";
 import { tokenizeBorder, tokenize_gradient } from "@designto/token";
+import { LinearGradient, RadialGradient } from "@reflect-ui/core";
 
 type DecorationBackgroundLike =
   | flutter.Color
@@ -106,16 +107,19 @@ export function makeBoxDecorationColorBg(
   switch (fill.type) {
     case "GRADIENT_ANGULAR":
     case "GRADIENT_DIAMOND":
-    case "GRADIENT_RADIAL":
       // TODO: handle above gradient types (only linear is handled)
       console.log(
         "not handled: `GRADIENT_RADIAL` | `GRADIENT_DIAMOND` | `GRADIENT_ANGULAR`"
       );
       return undefined;
     case "GRADIENT_LINEAR":
-      const g = tokenize_gradient(fill as Figma.GradientPaint);
-      return painting.linearGradient(g);
+      const lg = tokenize_gradient(fill as Figma.GradientPaint);
+      return painting.linearGradient(lg as LinearGradient);
+    case "GRADIENT_RADIAL":
+      const rg = tokenize_gradient(fill as Figma.GradientPaint);
+      return painting.radialGradient(rg as RadialGradient);
     case "SOLID":
+      console.log("solid color");
       return makeColorFromRGBO(fill.color, opacity);
     default:
       throw `making colored box decoraton with fill type "${fill?.type}" is not allowed."`;
diff --git a/packages/designto-flutter/painting/index.ts b/packages/designto-flutter/painting/index.ts
index a71c2c4d..50c252b0 100644
--- a/packages/designto-flutter/painting/index.ts
+++ b/packages/designto-flutter/painting/index.ts
@@ -6,6 +6,7 @@ export * from "./painting-box-shape";
 export * from "./painting-box-shadow";
 export * from "./painting-border";
 export * from "./painting-border-side";
+export * from "./painting-radial-gradient";
 export * from "./painting-text-style";
 export * from "./painting-text-decoration";
 export * from "./painting-font-style";
diff --git a/packages/designto-flutter/painting/painting-box-decoration.ts b/packages/designto-flutter/painting/painting-box-decoration.ts
index 6fcf9b5f..180f89ef 100644
--- a/packages/designto-flutter/painting/painting-box-decoration.ts
+++ b/packages/designto-flutter/painting/painting-box-decoration.ts
@@ -1,7 +1,9 @@
 import { BoxDecoration } from "@flutter-builder/flutter";
-import { Color } from "@reflect-ui/core";
+import { Color, Gradient, GradientType } from "@reflect-ui/core";
 import { Background } from "@reflect-ui/core/lib/background";
 import * as dartui from "../dart-ui";
+import { linearGradient } from "./painting-linear-gradient";
+import { radialGradient } from "./painting-radial-gradient";
 
 function fromColor(color: Color): BoxDecoration {
   return new BoxDecoration({
@@ -20,6 +22,7 @@ function fromBackground(b: Background): BoxDecoration {
     switch (b.type) {
       case "gradient": {
         console.error("gradient bg not ready");
+        return fromGradient(b as Gradient);
         break;
       }
       case "graphics": {
@@ -33,8 +36,25 @@ function fromBackground(b: Background): BoxDecoration {
   }
 }
 
-function fromGradient(): BoxDecoration {
-  throw "not ready.";
+function fromGradient(g: Gradient): BoxDecoration {
+  switch (g._type) {
+    case GradientType.LINEAR: {
+      return new BoxDecoration({
+        gradient: linearGradient(g),
+      });
+    }
+    case GradientType.RADIAL: {
+      return new BoxDecoration({
+        gradient: radialGradient(g),
+      });
+    }
+    default: {
+      // TODO: add;
+      // GRADIENT_ANGULAR;
+      // GRADIENT_DIAMOND;
+      throw "not ready.";
+    }
+  }
 }
 
 function fromImage(): BoxDecoration {
diff --git a/packages/designto-flutter/painting/painting-radial-gradient.ts b/packages/designto-flutter/painting/painting-radial-gradient.ts
new file mode 100644
index 00000000..27396036
--- /dev/null
+++ b/packages/designto-flutter/painting/painting-radial-gradient.ts
@@ -0,0 +1,12 @@
+import { RadialGradient } from "@reflect-ui/core";
+import * as flutter from "@flutter-builder/flutter";
+import * as dartui from "../dart-ui";
+
+export function radialGradient(g: RadialGradient): flutter.RadialGradient {
+  return new flutter.RadialGradient({
+    // TODO: add center
+    // TODO: add radius
+    colors: g.colors.map((c) => dartui.color(c)),
+    stops: g.stops,
+  });
+}
diff --git a/packages/designto-flutter/tokens-to-flutter-widget/index.ts b/packages/designto-flutter/tokens-to-flutter-widget/index.ts
index 81fecddf..7cc135f1 100644
--- a/packages/designto-flutter/tokens-to-flutter-widget/index.ts
+++ b/packages/designto-flutter/tokens-to-flutter-widget/index.ts
@@ -280,8 +280,8 @@ function compose(
         ..._deco_part_shape_and_border_radius,
         ..._deco_part_bg,
         boxShadow: painting.boxShadow(widget.boxShadow),
-        // TODO:
-        // background:
+        // TODO: background list
+        // background: painting.linearGradient(widget.background.gradient),
       }),
       //   key: _key,
     });
diff --git a/packages/designto-token/token-gradient/gradient.ts b/packages/designto-token/token-gradient/gradient.ts
index e9823687..949aa5f9 100644
--- a/packages/designto-token/token-gradient/gradient.ts
+++ b/packages/designto-token/token-gradient/gradient.ts
@@ -1,9 +1,13 @@
 import { Figma } from "@design-sdk/figma-types";
-import { Color, LinearGradient, Gradient } from "@reflect-ui/core";
+import {
+  Color,
+  LinearGradient,
+  Gradient,
+  RadialGradient,
+} from "@reflect-ui/core";
 import { color_utils } from "@design-sdk/core";
 import { tokenize_gradient_direction_from_angle } from "../token-gradient";
 import { roundNumber } from "@reflect-ui/uiutils";
-import { RadialGradient } from "@reflect-ui/core/lib/radial-gradient";
 
 export function tokenize_gradient(gradient: Figma.GradientPaint): Gradient {
   // TODO: Handle transform percisely.

From 29e72152c7936670eb76c6a31be1e6f6dba617d4 Mon Sep 17 00:00:00 2001
From: PACMAN <ijyk3061@gmail.com>
Date: Mon, 15 Nov 2021 16:58:48 +0900
Subject: [PATCH 05/15] fix not handle log

---
 packages/designto-flutter/make/make-flutter-box-decoration.ts | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/packages/designto-flutter/make/make-flutter-box-decoration.ts b/packages/designto-flutter/make/make-flutter-box-decoration.ts
index 38cb6870..33dd8ea0 100644
--- a/packages/designto-flutter/make/make-flutter-box-decoration.ts
+++ b/packages/designto-flutter/make/make-flutter-box-decoration.ts
@@ -108,9 +108,7 @@ export function makeBoxDecorationColorBg(
     case "GRADIENT_ANGULAR":
     case "GRADIENT_DIAMOND":
       // TODO: handle above gradient types (only linear is handled)
-      console.log(
-        "not handled: `GRADIENT_RADIAL` | `GRADIENT_DIAMOND` | `GRADIENT_ANGULAR`"
-      );
+      console.log("not handled: `GRADIENT_DIAMOND` | `GRADIENT_ANGULAR`");
       return undefined;
     case "GRADIENT_LINEAR":
       const lg = tokenize_gradient(fill as Figma.GradientPaint);

From 51a943292d2f219079a730903cb2dd602fa25592 Mon Sep 17 00:00:00 2001
From: PACMAN <ijyk3061@gmail.com>
Date: Mon, 15 Nov 2021 19:07:37 +0900
Subject: [PATCH 06/15] update package

---
 externals/reflect-core                               | 2 +-
 packages/builder-css-styles/radial-gradient/index.ts | 6 ++----
 packages/designto-token/token-gradient/gradient.ts   | 4 ++--
 3 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/externals/reflect-core b/externals/reflect-core
index ee83a6f2..2404c1f2 160000
--- a/externals/reflect-core
+++ b/externals/reflect-core
@@ -1 +1 @@
-Subproject commit ee83a6f27f73559138e56faaebb9567b694a617d
+Subproject commit 2404c1f234677b79d2f86716916088453c1865b1
diff --git a/packages/builder-css-styles/radial-gradient/index.ts b/packages/builder-css-styles/radial-gradient/index.ts
index 51f76321..38cbce10 100644
--- a/packages/builder-css-styles/radial-gradient/index.ts
+++ b/packages/builder-css-styles/radial-gradient/index.ts
@@ -11,10 +11,8 @@ import { color } from "../color";
 export function radialGradient(g: RadialGradientManifest): CSSProperty.Color {
   // throw "css gradient not ready";
   // TODO:
-  // 1. stops support
-  // 2. angle support
-  var angleDeg =
-    (Math.atan2(g.begin.y - g.end.y, g.begin.x - g.end.x) * 180) / Math.PI;
+  // 1. center support
+  // 2. radius support
 
   const colors = g.colors.map(color).join(", ");
   return `radial-gradient(${colors})`;
diff --git a/packages/designto-token/token-gradient/gradient.ts b/packages/designto-token/token-gradient/gradient.ts
index 949aa5f9..cf60b361 100644
--- a/packages/designto-token/token-gradient/gradient.ts
+++ b/packages/designto-token/token-gradient/gradient.ts
@@ -49,10 +49,10 @@ export function tokenize_gradient(gradient: Figma.GradientPaint): Gradient {
       });
     case "GRADIENT_RADIAL":
       return new RadialGradient({
-        begin: direction.begin,
-        end: direction.end,
+        center: direction.begin,
         colors: colors,
         stops: stopPoints,
+        // TODO: support radius
       });
 
       console.error("GRADIENT_RADIAL not handled");

From b1c2a19ee9205e20643d8fc568c387abb060428e Mon Sep 17 00:00:00 2001
From: PACMAN <ijyk3061@gmail.com>
Date: Mon, 15 Nov 2021 19:31:22 +0900
Subject: [PATCH 07/15] update pacakge

---
 externals/reflect-core | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/externals/reflect-core b/externals/reflect-core
index 2404c1f2..b10ded61 160000
--- a/externals/reflect-core
+++ b/externals/reflect-core
@@ -1 +1 @@
-Subproject commit 2404c1f234677b79d2f86716916088453c1865b1
+Subproject commit b10ded6159f79bb3d10d9918bc534b9b8b81aeaf

From 041e781f2c064de9a8d64efa7b2d25303041d350 Mon Sep 17 00:00:00 2001
From: PACMAN <ijyk3061@gmail.com>
Date: Mon, 15 Nov 2021 19:50:47 +0900
Subject: [PATCH 08/15] update package

---
 externals/reflect-core | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/externals/reflect-core b/externals/reflect-core
index b10ded61..3cec8937 160000
--- a/externals/reflect-core
+++ b/externals/reflect-core
@@ -1 +1 @@
-Subproject commit b10ded6159f79bb3d10d9918bc534b9b8b81aeaf
+Subproject commit 3cec89370a4fd8b03c3b4a2ca7d98eea8d9b831a

From f8a91734a8289971520d542feb71e5e83b431966 Mon Sep 17 00:00:00 2001
From: PACMAN <ijyk3061@gmail.com>
Date: Mon, 15 Nov 2021 20:12:12 +0900
Subject: [PATCH 09/15] remove log and fix more safer to using switch

---
 packages/designto-flutter/painting/painting-box-decoration.ts | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/packages/designto-flutter/painting/painting-box-decoration.ts b/packages/designto-flutter/painting/painting-box-decoration.ts
index 180f89ef..0b49c4d3 100644
--- a/packages/designto-flutter/painting/painting-box-decoration.ts
+++ b/packages/designto-flutter/painting/painting-box-decoration.ts
@@ -21,7 +21,6 @@ function fromBackground(b: Background): BoxDecoration {
   } else {
     switch (b.type) {
       case "gradient": {
-        console.error("gradient bg not ready");
         return fromGradient(b as Gradient);
         break;
       }
@@ -37,7 +36,7 @@ function fromBackground(b: Background): BoxDecoration {
 }
 
 function fromGradient(g: Gradient): BoxDecoration {
-  switch (g._type) {
+  switch (g?._type) {
     case GradientType.LINEAR: {
       return new BoxDecoration({
         gradient: linearGradient(g),

From 4195e9185847c226699d566b965a23e3a624b2e8 Mon Sep 17 00:00:00 2001
From: PACMAN <ijyk3061@gmail.com>
Date: Mon, 15 Nov 2021 20:13:01 +0900
Subject: [PATCH 10/15] fix throw error

---
 packages/designto-flutter/painting/painting-box-decoration.ts | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/packages/designto-flutter/painting/painting-box-decoration.ts b/packages/designto-flutter/painting/painting-box-decoration.ts
index 0b49c4d3..85eef64f 100644
--- a/packages/designto-flutter/painting/painting-box-decoration.ts
+++ b/packages/designto-flutter/painting/painting-box-decoration.ts
@@ -51,7 +51,9 @@ function fromGradient(g: Gradient): BoxDecoration {
       // TODO: add;
       // GRADIENT_ANGULAR;
       // GRADIENT_DIAMOND;
-      throw "not ready.";
+      throw new Error(
+        `Gradient type of "${g}" is not yet supported on flutter platform.`
+      );
     }
   }
 }

From 3375788314e3f3b5c3a62bb309c5b843c8f1cf58 Mon Sep 17 00:00:00 2001
From: PACMAN <ijyk3061@gmail.com>
Date: Mon, 15 Nov 2021 20:13:31 +0900
Subject: [PATCH 11/15] remove log

---
 packages/designto-token/token-gradient/gradient.ts | 1 -
 1 file changed, 1 deletion(-)

diff --git a/packages/designto-token/token-gradient/gradient.ts b/packages/designto-token/token-gradient/gradient.ts
index cf60b361..8e1dc088 100644
--- a/packages/designto-token/token-gradient/gradient.ts
+++ b/packages/designto-token/token-gradient/gradient.ts
@@ -55,7 +55,6 @@ export function tokenize_gradient(gradient: Figma.GradientPaint): Gradient {
         // TODO: support radius
       });
 
-      console.error("GRADIENT_RADIAL not handled");
     // TODO:
     case "GRADIENT_ANGULAR":
       console.error("GRADIENT_ANGULAR not handled");

From f4ef3593f2a844b0265350f7ebbe1f3c4b0a449f Mon Sep 17 00:00:00 2001
From: PACMAN <ijyk3061@gmail.com>
Date: Mon, 15 Nov 2021 20:16:48 +0900
Subject: [PATCH 12/15] remove log

---
 packages/builder-css-styles/radial-gradient/index.ts | 1 -
 1 file changed, 1 deletion(-)

diff --git a/packages/builder-css-styles/radial-gradient/index.ts b/packages/builder-css-styles/radial-gradient/index.ts
index 38cbce10..60db4811 100644
--- a/packages/builder-css-styles/radial-gradient/index.ts
+++ b/packages/builder-css-styles/radial-gradient/index.ts
@@ -9,7 +9,6 @@ import { color } from "../color";
  * @returns
  */
 export function radialGradient(g: RadialGradientManifest): CSSProperty.Color {
-  // throw "css gradient not ready";
   // TODO:
   // 1. center support
   // 2. radius support

From 999e0a646354febfd5ce7a36e881b38740b34575 Mon Sep 17 00:00:00 2001
From: PACMAN <ijyk3061@gmail.com>
Date: Mon, 15 Nov 2021 20:22:15 +0900
Subject: [PATCH 13/15] add undefined case

---
 .../designto-flutter/painting/painting-box-decoration.ts     | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/packages/designto-flutter/painting/painting-box-decoration.ts b/packages/designto-flutter/painting/painting-box-decoration.ts
index 85eef64f..e2fc7a17 100644
--- a/packages/designto-flutter/painting/painting-box-decoration.ts
+++ b/packages/designto-flutter/painting/painting-box-decoration.ts
@@ -47,6 +47,11 @@ function fromGradient(g: Gradient): BoxDecoration {
         gradient: radialGradient(g),
       });
     }
+
+    // It is only used to make it safer in case of an emergency.
+    case undefined: {
+      return;
+    }
     default: {
       // TODO: add;
       // GRADIENT_ANGULAR;

From f497dc18d8722f36b77ef7f07bf236d9fb2347eb Mon Sep 17 00:00:00 2001
From: PACMAN <ijyk3061@gmail.com>
Date: Mon, 15 Nov 2021 20:36:05 +0900
Subject: [PATCH 14/15] update package

---
 externals/reflect-core | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/externals/reflect-core b/externals/reflect-core
index 3cec8937..636ed0b7 160000
--- a/externals/reflect-core
+++ b/externals/reflect-core
@@ -1 +1 @@
-Subproject commit 3cec89370a4fd8b03c3b4a2ca7d98eea8d9b831a
+Subproject commit 636ed0b7f86757c76604c1397f712f971fa27995

From 98428b7e139f28b914c7905b40865968e65c8479 Mon Sep 17 00:00:00 2001
From: PACMAN <ijyk3061@gmail.com>
Date: Mon, 15 Nov 2021 20:45:17 +0900
Subject: [PATCH 15/15] update package

---
 externals/reflect-core | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/externals/reflect-core b/externals/reflect-core
index 636ed0b7..cc76dca6 160000
--- a/externals/reflect-core
+++ b/externals/reflect-core
@@ -1 +1 @@
-Subproject commit 636ed0b7f86757c76604c1397f712f971fa27995
+Subproject commit cc76dca6a282d323353fbc1fa9d784fa06e949bd
