Organiza tus páginas con colecciones
Guarda y categoriza el contenido según tus preferencias.
Sugerir mejoras para seguir las prácticas recomendadas de diseño de Compose
Please analyze the Compose layout below and suggest improvements to ensure it is performance and is aligned with best practices.
Suggest specific optimizations, including but not limited to:
- State Hoisting: Move state up to the lowest common ancestor that needs access to it. This improves testability and makes components more reusable.
- Unidirectional Data Flow: Data flows down, events flow up. This makes debugging and reasoning about your UI easier. Use remember to store state, and pass lambdas for events.
- Immutable Data: Use data classes and Immutable annotations where possible. This helps Compose optimize recompositions.
- Using 'remember' to cache results, but only for values that should survive recompositions (as this could cause a memory leak)
- Using the 'key' parameter in lazy layouts to avoid unnecessary recompositions
- Using 'derivedStateOf' for rapidly changing states
- Avoiding backwards writes, changing state after it has been in a composable ot prevent recomposition loops
- Ensuring breaking down UI into smaller composables that do one thing well
- Proper state management, hoisting state to parent comptables and using lifecycle-aware coroutine scopes like 'viewModelScope' or 'lifecycleScope' for async operations
- Adhering to Jetpack Compose API guidelines for naming, layering components, and ensuring accessibility
- Using Baseline Profiles and R8 optimizations
- Passing a 'Modifier' parameter in composables to allow customization and maintain consistency
- Not excessively overusing modifiers, resulting in reduced readability and clutter
- Unnecessary use of WebView inside of Comparables
Please only tell me where my code can be improved. Do not mention areas where my code is already compliant with best practices.
Do not write code in your initial response. Instead, ask the developer whether they would like you to attempt to make some of these changes first.
$CURRENT_FILE
El contenido y las muestras de código que aparecen en esta página están sujetas a las licencias que se describen en la Licencia de Contenido. Java y OpenJDK son marcas registradas de Oracle o sus afiliados.
Última actualización: 2025-08-08 (UTC)
[[["Fácil de comprender","easyToUnderstand","thumb-up"],["Resolvió mi problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Falta la información que necesito","missingTheInformationINeed","thumb-down"],["Muy complicado o demasiados pasos","tooComplicatedTooManySteps","thumb-down"],["Desactualizado","outOfDate","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Problema con las muestras o los códigos","samplesCodeIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 2025-08-08 (UTC)"],[],[],null,["# Analyze Compose layout\n\nSuggest improvements to follow Compose layout best practices.\n\n*** ** * ** ***\n\n Please analyze the Compose layout below and suggest improvements to ensure it is performance and is aligned with best practices.\n\n Suggest specific optimizations, including but not limited to:\n\n\n - State Hoisting: Move state up to the lowest common ancestor that needs access to it. This improves testability and makes components more reusable.\n - Unidirectional Data Flow: Data flows down, events flow up. This makes debugging and reasoning about your UI easier. Use remember to store state, and pass lambdas for events.\n - Immutable Data: Use data classes and Immutable annotations where possible. This helps Compose optimize recompositions.\n - Using 'remember' to cache results, but only for values that should survive recompositions (as this could cause a memory leak)\n - Using the 'key' parameter in lazy layouts to avoid unnecessary recompositions\n - Using 'derivedStateOf' for rapidly changing states\n - Avoiding backwards writes, changing state after it has been in a composable ot prevent recomposition loops\n - Ensuring breaking down UI into smaller composables that do one thing well\n - Proper state management, hoisting state to parent comptables and using lifecycle-aware coroutine scopes like 'viewModelScope' or 'lifecycleScope' for async operations\n - Adhering to Jetpack Compose API guidelines for naming, layering components, and ensuring accessibility\n - Using Baseline Profiles and R8 optimizations\n - Passing a 'Modifier' parameter in composables to allow customization and maintain consistency\n - Not excessively overusing modifiers, resulting in reduced readability and clutter\n - Unnecessary use of WebView inside of Comparables\n\n Please only tell me where my code can be improved. Do not mention areas where my code is already compliant with best practices.\n\n Do not write code in your initial response. Instead, ask the developer whether they would like you to attempt to make some of these changes first.\n\n $CURRENT_FILE\n\n\n| To run this prompt in Android Studio, click **Gemini** in the sidebar and paste it in the chat field. \n| To save and retrieve prompts in the Studio IDE, go to **Settings \\\u003e Gemini \\\u003e Prompt Library**.\n\n*** ** * ** ***"]]