Skip to content

Latest commit

 

History

History
64 lines (45 loc) · 1.51 KB

README.md

File metadata and controls

64 lines (45 loc) · 1.51 KB

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