Aspecto is a grid layout that perfectly preserves each item's aspect ratio for the Jetpack Compose / Compose Multiplatform.
✨ Just as the 🪄 Patronus charm protects its caster, Aspecto protects image layouts from distortion!
Aspecto.-.Compose.Multiplatform.mp4
- Aspect Ratio Preservation - Maintains natural dimensions of images
- Smart Row Distribution - Magically arranges items for optimal space utilization
- ️Efficient Updates - Uses incremental calculations for smooth performance
- Height Protection - Guards against overly tall items disrupting layouts
- Responsive Layout - Adapts gracefully to different screen sizes
- Android
- iOS
Add the dependency to your project:
implementation("com.vipulasri.aspecto:aspecto:<latest-version>")
implementation("com.vipulasri.aspecto:aspecto-android:<latest-version>")
AspectoGrid(
modifier = Modifier.fillMaxWidth(),
contentPadding = PaddingValues(16.dp)
) {
items(
items = images,
key = { it.id },
aspectRatio = { it.width.toFloat() / it.height }
) { image ->
// content
}
}
Android & iOS samples. Both samples use the same shared code to demonstrate the Compose Multiplatform capabilities.
- Greedo Layout from 500px
Copyright 2025 Vipul Asri
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.