-
-
Save DUMA042/eb0c641e5c51e1a3b8b3d604b4c5724b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Initialize the camera controller with the current context | |
val cameraController = remember { | |
LifecycleCameraController(context) | |
} | |
// AndroidView to integrate the camera preview and barcode scanning | |
AndroidView( | |
modifier = modifier.fillMaxSize(), // Make the view take up the entire screen | |
factory = { ctx -> | |
PreviewView(ctx).apply { | |
// Bind the camera controller to the lifecycle owner | |
cameraController.bindToLifecycle(lifecycleOwner) | |
// Set the camera controller for the PreviewView | |
this.controller = cameraController | |
} | |
} | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment