( autoLayout: InferredAutoLayoutResult, children: string, )
| 280 | }; |
| 281 | |
| 282 | const 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 | |
| 321 | export const composeCodeGenTextStyles = () => { |
| 322 | const result = previousExecutionCache |
no test coverage detected