MCPcopy Index your code
hub / github.com/bernaferrari/FigmaToCode / makeRowColumnWrap

Function makeRowColumnWrap

packages/backend/src/compose/composeMain.ts:282–319  ·  view source on GitHub ↗
(
  autoLayout: InferredAutoLayoutResult,
  children: string,
)

Source from the content-addressed store, hash-verified

280};
281
282const makeRowColumnWrap = (
283 autoLayout: InferredAutoLayoutResult,
284 children: string,
285): string => {
286 const isRow = autoLayout.layoutMode === "HORIZONTAL";
287 const composable = isRow ? "Row" : "Column";
288
289 const widgetProps: Record<string, any> = {};
290
291 // Add alignment properties
292 if (isRow) {
293 widgetProps.horizontalArrangement = getMainAxisAlignment(autoLayout);
294 widgetProps.verticalAlignment = getCrossAxisAlignment(autoLayout);
295 } else {
296 widgetProps.verticalArrangement = getMainAxisAlignment(autoLayout);
297 widgetProps.horizontalAlignment = getCrossAxisAlignment(autoLayout);
298 }
299
300 // Add spacing if needed
301 if (autoLayout.itemSpacing > 0) {
302 const arrangement = isRow ? "horizontalArrangement" : "verticalArrangement";
303 const currentArrangement = widgetProps[arrangement];
304 // If we already have an arrangement, combine with spacedBy
305 if (currentArrangement && currentArrangement.includes("Arrangement.")) {
306 widgetProps[arrangement] =
307 `Arrangement.spacedBy(${autoLayout.itemSpacing}.dp, ${currentArrangement})`;
308 } else {
309 widgetProps[arrangement] =
310 `Arrangement.spacedBy(${autoLayout.itemSpacing}.dp)`;
311 }
312 } else if (autoLayout.itemSpacing < 0) {
313 addWarning("Compose doesn't support negative itemSpacing");
314 }
315
316 widgetProps.content = [children];
317
318 return generateComposeWidget(composable, widgetProps);
319};
320
321export const composeCodeGenTextStyles = () => {
322 const result = previousExecutionCache

Callers 1

composeFrameFunction · 0.70

Calls 4

getMainAxisAlignmentFunction · 0.90
getCrossAxisAlignmentFunction · 0.90
addWarningFunction · 0.90
generateComposeWidgetFunction · 0.85

Tested by

no test coverage detected