Last active
July 13, 2024 18:03
-
-
Save tdcolvin/4058ae8b3f0b4e00f85a48b1ebf902df 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
@Composable | |
fun TakePhotoScreen(modifier: Modifier = Modifier) { | |
// The location on disk where the photo was saved to, or null if no photo | |
var imageUri by remember { mutableStateOf<Uri?>(null) } | |
Column(modifier = modifier) { | |
// We'll define this later... | |
TakePhotoButton( | |
onPhotoTaken = { imageUri = it } | |
) | |
if (imageUri != null) { | |
// This composable is from the Coil library | |
AsyncImage( | |
modifier = Modifier | |
.weight(1f) | |
.fillMaxWidth(), | |
contentScale = ContentScale.Fit, | |
model = imageUri, | |
contentDescription = "Photo taken by user" | |
) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment