load-the-image

load-the-image Apply to compose-jb(desktop), Used to load network and local pictures.

🚀Under construction

It may change incompatibly and require manual migration in the future. We would appreciate your feedback on it in Issues.

Mode of use

Root dir, settings.gradle add:

allprojects {
	repositories {
		...
		maven { url 'https://jitpack.io' }
	}
}

build.gradle add:

repositories {
    	...
    	maven { url 'https://jitpack.io' }
}

If you just use compose-desktop

version =

Your compose-desktop dir, build.gradle add:

dependencies {
	implementation 'com.github.ltttttttttttt:load-the-image:$version'
}

Use the code load image with network and file and resources

Image(rememberImagePainter(/*url*/"https://img.zcool.cn/community/[email protected]_1l_2o_100sh.jpg","")

If you use compose(Kotlin Multiplatform), You can refer to the example.

version =

Your common dir, build.gradle add:

val desktopMain by getting{
	dependencies {
		implementation 'com.github.ltttttttttttt:load-the-image:$version'
	}
}

commonMain add function:

@Composable
expect fun rememberImagePainter(url: String): Painter

androidMain add function(and other target):

@Composable
actual fun rememberImagePainter(url: String): Painter =
    coil.compose.rememberImagePainter(data = url)

desktopMain add function:

@Composable
actual fun rememberImagePainter(url: String): Painter =
    com.lt.load_the_image.rememberImagePainter(url)
    

Use the code load image with network and file and resources

Image(rememberImagePainter(/*url*/"https://img.zcool.cn/community/[email protected]_1l_2o_100sh.jpg","")

GitHub

View Github