This library provides alternative implementation of PhotoView for Jetpack Compose.
Add this in your root build.gradle
file (not your module build.gradle
file):
allprojects {
repositories {
mavenCentral()
}
}
buildscript {
repositories {
mavenCentral()
}
}
Then, add the library to your module build.gradle
dependencies {
implementation 'io.github.fornewid:photo-compose:<version>'
}
There is a sample provided which shows how to use the library.
Here is a simple example that works:
val painter = painterResource(R.drawable.image)
val photoState = rememberPhotoState()
photoState.setPhotoIntrinsicSize(painter.intrinsicSize)
PhotoBox(state = photoState) {
Image(
painter,
contentDescription = "image",
modifier = Modifier.fillMaxSize(),
)
}
Licensed under the Apache 2.0 license. See LICENSE for details.