Created
June 10, 2022 02:02
-
-
Save navczydev/d35fa64dbe22977f8798adac3368288d 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 PhotoPickerResultComposable() { | |
var result by rememberSaveable { mutableStateOf<Uri?>(null) } | |
val launcher = | |
rememberLauncherForActivityResult(ActivityResultContracts.StartActivityForResult()) { | |
result = it.data?.data | |
} | |
Column( | |
verticalArrangement = Arrangement.Center, | |
horizontalAlignment = Alignment.CenterHorizontally | |
) { | |
OpenPhotoPicker(openLauncher = { launcher.launch(photoIntent) }) | |
AsyncImage( | |
model = result, | |
contentDescription = "Image from photo picker", | |
contentScale = ContentScale.Crop, | |
modifier = Modifier | |
.size(200.dp, 200.dp) | |
.clip(CircleShape) | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment