44 IReflectCornerMixin ,
55} from "@bridged.xyz/design-sdk/lib/nodes/types" ;
66import { interpretRadius } from "../interpreter/radius.interpret" ;
7+ import * as core from "@reflect-ui/core" ;
78
89export function makeBorderRadius (
910 node : IReflectCornerMixin
@@ -15,10 +16,26 @@ export function makeBorderRadius(
1516
1617 return node . cornerRadius . all !== undefined
1718 ? flutter . BorderRadius . circular ( node . cornerRadius . all as number )
18- : flutter . BorderRadius . only ( {
19- topLeft : interpretRadius ( node . cornerRadius . tl ) ,
20- topRight : interpretRadius ( node . cornerRadius . tr ) ,
21- bottomLeft : interpretRadius ( node . cornerRadius . bl ) ,
22- bottomRight : interpretRadius ( node . cornerRadius . br ) ,
23- } ) ;
19+ : _makePartialBorderRadius ( node . cornerRadius ) ;
20+ }
21+
22+ function _makePartialBorderRadius ( cornerRadius : core . BorderRadiusManifest ) {
23+ const _oneofRadiusIsHasValue = [
24+ cornerRadius . tl ,
25+ cornerRadius . tr ,
26+ cornerRadius . bl ,
27+ cornerRadius . br ,
28+ ] . some ( ( i ) => i !== undefined ) ;
29+
30+ if ( _oneofRadiusIsHasValue ) {
31+ return flutter . BorderRadius . only ( {
32+ topLeft : interpretRadius ( cornerRadius . tl ) ,
33+ topRight : interpretRadius ( cornerRadius . tr ) ,
34+ bottomLeft : interpretRadius ( cornerRadius . bl ) ,
35+ bottomRight : interpretRadius ( cornerRadius . br ) ,
36+ } ) ;
37+ } else {
38+ // if none of each corner radius contains value (if every value is empty) do not return a value.
39+ return ;
40+ }
2441}
0 commit comments