1- import {
2- ReflectEllipseNode ,
3- ReflectFrameNode ,
4- ReflectRectangleNode ,
5- } from "@bridged.xyz/design-sdk/lib/nodes" ;
1+ import { nodes } from "@bridged.xyz/design-sdk" ;
62import { retrieveFill } from "@bridged.xyz/design-sdk/lib/utils" ;
7- import {
8- BoxDecoration ,
9- BoxFit ,
10- BoxShape ,
11- Color ,
12- DecorationImage ,
13- Gradient ,
14- ImageProvider ,
15- Snippet ,
16- } from "@bridged.xyz/flutter-builder" ;
3+ import * as flutter from "@bridged.xyz/flutter-builder" ;
174import { interpretGradient } from "../interpreter/gradient.interpret" ;
185import { interpretImageFills } from "../interpreter/image.interpret" ;
196import { makeBorderRadius } from "./border-radius.make" ;
@@ -23,17 +10,20 @@ import { makeColorFromRGBO } from "./color.make";
2310import { Figma } from "@bridged.xyz/design-sdk" ;
2411
2512export function makeBoxDecoration (
26- node : ReflectRectangleNode | ReflectEllipseNode | ReflectFrameNode
27- ) : BoxDecoration | Color {
13+ node :
14+ | nodes . ReflectRectangleNode
15+ | nodes . ReflectEllipseNode
16+ | nodes . ReflectFrameNode
17+ ) : flutter . BoxDecoration | flutter . Color {
2818 const decorationBackground = makeBoxDecorationBg ( node . fills ) ;
2919 const decorationBorder = makeBorder ( node ) ;
3020 const decorationBoxShadow = makeBoxShadow ( node ) ;
3121 const decorationBorderRadius = makeBorderRadius ( node ) ;
3222
3323 // modify the circle's shape when type is ellipse
34- const decorationShape : BoxShape =
35- node instanceof ReflectEllipseNode
36- ? ( BoxShape . circle as Snippet )
24+ const decorationShape : flutter . BoxShape =
25+ node instanceof nodes . ReflectEllipseNode
26+ ? ( flutter . BoxShape . circle as flutter . Snippet )
3727 : undefined ;
3828
3929 // generate the decoration, or just the backgroundColor when color is SOLID.
@@ -45,35 +35,35 @@ export function makeBoxDecoration(
4535 decorationBackground ;
4636
4737 return isNotSolid
48- ? new BoxDecoration ( {
38+ ? new flutter . BoxDecoration ( {
4939 borderRadius : decorationBorderRadius ,
5040 shape : decorationShape ,
5141 image :
52- decorationBackground instanceof ImageProvider
53- ? new DecorationImage ( {
42+ decorationBackground instanceof flutter . ImageProvider
43+ ? new flutter . DecorationImage ( {
5444 image : decorationBackground ,
55- fit : BoxFit . cover as Snippet ,
45+ fit : flutter . BoxFit . cover as flutter . Snippet ,
5646 } )
5747 : undefined ,
5848 border : decorationBorder ,
5949 boxShadow : decorationBoxShadow ,
6050 color :
61- decorationBackground instanceof Color
62- ? ( decorationBackground as Color )
51+ decorationBackground instanceof flutter . Color
52+ ? ( decorationBackground as flutter . Color )
6353 : undefined ,
6454 gradient :
65- decorationBackground instanceof Gradient
66- ? ( decorationBackground as Gradient )
55+ decorationBackground instanceof flutter . Gradient
56+ ? ( decorationBackground as flutter . Gradient )
6757 : undefined ,
6858 } )
69- : decorationBackground instanceof Color
70- ? ( decorationBackground as Color )
59+ : decorationBackground instanceof flutter . Color
60+ ? ( decorationBackground as flutter . Color )
7161 : undefined ;
7262}
7363
7464export function makeBoxDecorationBg (
7565 fills : ReadonlyArray < Figma . Paint >
76- ) : Gradient | Color | ImageProvider {
66+ ) : flutter . Gradient | flutter . Color | flutter . ImageProvider {
7767 const fill = retrieveFill ( fills ) ;
7868
7969 if ( fill ?. type === "SOLID" ) {
0 commit comments