Skip to content

[Jetpack Compose] Library for capturing Composable components

License

Notifications You must be signed in to change notification settings

yonghanJu/CaptureComposable

Repository files navigation

CaptureComposable

Yong's Blog Dev Dialog

Library for capturing Composable components

  • app module is demo app

  • capture module is Android Library for capturing composable contains and contains CaptureState, CaptureResult, @Composable Capture

How to

To get a Git project into your build:

Step 1. Add the JitPack repository to your build file

Add it in your root build.gradle at the end of repositories:

// root level settings.gradle.kts
repositories {
    // ...
    maven("https://jitpack.io")
}

Step 2. Add the dependency

// module level build.gradle.kts 
dependencies {
    val latestVersion = "1.0.2" 
    implementation("com.github.yonghanJu:CaptureComposable:$latestVersion")
}

Example Code

val captureState = rememberCaptureState()

Capture(
    modifier = Modifier
    captureState = captureState,
) {
    // @Composable content
}

// Captured
Button(onClick = { captureState.capture() })

// ...

// you can use these
captureState.bitmap // captured bitmap
captureState.state // capturedState(Initialized, Success(bitmap), Error(e))

Demo App

About

[Jetpack Compose] Library for capturing Composable components

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages