Only display delete icon when user avatar is selected

Signed-off-by: sowjanyakch <sowjanya.kch@gmail.com>
This commit is contained in:
sowjanyakch 2024-09-18 17:57:54 +02:00 committed by Marcel Hibbe
parent 44e87dbd42
commit 317f745806
No known key found for this signature in database
GPG key ID: C793F8B59F43CE7B

View file

@ -209,7 +209,8 @@ fun ConversationCreationScreen(
imagePickerLauncher = imagePickerLauncher, imagePickerLauncher = imagePickerLauncher,
remoteFilePickerLauncher = remoteFilePickerLauncher, remoteFilePickerLauncher = remoteFilePickerLauncher,
cameraLauncher = cameraLauncher, cameraLauncher = cameraLauncher,
onDeleteImage = { selectedImageUri = null } onDeleteImage = { selectedImageUri = null },
selectedImageUri = selectedImageUri
) )
ConversationNameAndDescription(conversationCreationViewModel) ConversationNameAndDescription(conversationCreationViewModel)
@ -258,7 +259,8 @@ fun UploadAvatar(
imagePickerLauncher: ManagedActivityResultLauncher<Intent, ActivityResult>, imagePickerLauncher: ManagedActivityResultLauncher<Intent, ActivityResult>,
remoteFilePickerLauncher: ManagedActivityResultLauncher<Intent, ActivityResult>, remoteFilePickerLauncher: ManagedActivityResultLauncher<Intent, ActivityResult>,
cameraLauncher: ManagedActivityResultLauncher<Intent, ActivityResult>, cameraLauncher: ManagedActivityResultLauncher<Intent, ActivityResult>,
onDeleteImage: () -> Unit onDeleteImage: () -> Unit,
selectedImageUri: Uri?
) { ) {
Row( Row(
modifier = Modifier modifier = Modifier
@ -299,6 +301,7 @@ fun UploadAvatar(
) )
} }
if (selectedImageUri != null) {
IconButton(onClick = { IconButton(onClick = {
onDeleteImage() onDeleteImage()
}) { }) {
@ -310,6 +313,7 @@ fun UploadAvatar(
} }
} }
} }
}
@Composable @Composable
fun ConversationNameAndDescription(conversationCreationViewModel: ConversationCreationViewModel) { fun ConversationNameAndDescription(conversationCreationViewModel: ConversationCreationViewModel) {