@Composable public fun AttachmentsPicker(attachmentsPickerViewModel: AttachmentsPickerViewModel,onAttachmentsSelected: (List<Attachment>) -> Unit,onDismiss: () -> Unit, modifier: Modifier = Modifier, tabFactories: List<AttachmentsPickerTabFactory> = ChatTheme.attachmentsPickerTabFactories,shape: Shape = ChatTheme.shapes.bottomSheet,) {var selectedTabIndex by remember { mutableStateOf(0) }Box(modifier = Modifier.fillMaxSize().background(ChatTheme.colors.overlay).clickable(onClick = onDismiss,indication = null,interactionSource = remember { MutableInteractionSource() })) {Card(modifier = modifier.clickable(indication = null,onClick = {},interactionSource = remember { MutableInteractionSource() }),elevation = 4.dp,shape = shape,backgroundColor = ChatTheme.colors.inputBackground,) {Column {AttachmentPickerOptions(hasPickedAttachments = attachmentsPickerViewModel.hasPickedAttachments,tabFactories = tabFactories,tabIndex = selectedTabIndex,onTabClick = { index, attachmentPickerMode -> selectedTabIndex = indexattachmentsPickerViewModel.changeAttachmentPickerMode(attachmentPickerMode) { false }},onSendAttachmentsClick = {onAttachmentsSelected(attachmentsPickerViewModel.getSelectedAttachments())},)Surface(modifier = Modifier.fillMaxSize(),shape = RoundedCornerShape(topStart =16.dp, topEnd = 16.dp),color = ChatTheme.colors.barsBackground,) {tabFactories.getOrNull(selectedTabIndex)?.pickerTabContent(attachments =attachmentsPickerViewModel.attachments,onAttachmentItemSelected = attachmentsPickerViewModel::changeSelectedAttachments,onAttachmentsChanged = { attachmentsPickerViewModel.attachments = it },onAttachmentsSubmitted = {onAttachmentsSelected(attachmentsPickerViewModel.getAttachmentsFromMetaData(it))},)}}}}}
Represents the bottom bar UI that allows users to pick attachments. The picker renders its tabs based on the [tabFactories] parameter. Out of the box we provide factories for images, files and media capture tabs.