Skip to content

Instantly share code, notes, and snippets.

@tdcolvin
Last active July 13, 2024 18:03
Show Gist options
  • Save tdcolvin/4058ae8b3f0b4e00f85a48b1ebf902df to your computer and use it in GitHub Desktop.
Save tdcolvin/4058ae8b3f0b4e00f85a48b1ebf902df to your computer and use it in GitHub Desktop.
@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