
Grid layout ensures each item's aspect ratio is preserved, preventing distortion. Features smart row distribution, height protection, and responsive design for seamless image layouts.
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!
https://github.com/user-attachments/assets/58cd864b-0a82-431b-ac6e-de755f885b98
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.
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.
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!
https://github.com/user-attachments/assets/58cd864b-0a82-431b-ac6e-de755f885b98
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.
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.