dm-162
This commit is contained in:
parent
b213991820
commit
993610d077
1 changed files with 24 additions and 14 deletions
|
|
@ -84,14 +84,31 @@ fun MessageAttachmentBar(
|
||||||
val localImages = remember { mutableStateListOf<Uri>() }
|
val localImages = remember { mutableStateListOf<Uri>() }
|
||||||
var refreshTrigger by remember { mutableStateOf(0) }
|
var refreshTrigger by remember { mutableStateOf(0) }
|
||||||
|
|
||||||
//attachment menu
|
// 🎯 1. 新增一個 State 來追蹤目前畫面上應該顯示什麼標題,預設為 "Attachment"
|
||||||
|
var currentMenuTitle by remember { mutableStateOf("Attachment") }
|
||||||
|
|
||||||
|
// attachment menu
|
||||||
val attachmentOptions = remember {
|
val attachmentOptions = remember {
|
||||||
listOf(
|
listOf(
|
||||||
AttachmentOption("圖片", Icons.Default.Image, { /* 已在網格處理,這裡可做其他事 */ }),
|
AttachmentOption("圖片", Icons.Default.Image, {
|
||||||
AttachmentOption("音訊", Icons.Default.Audiotrack, onAudioClick),
|
currentMenuTitle = "Media" // 點擊圖片或重置時回到原來的標題
|
||||||
AttachmentOption("文件", Icons.Default.Description, onDocumentClick),
|
}),
|
||||||
AttachmentOption("位置", Icons.Default.LocationOn, onLocationClick),
|
AttachmentOption("音訊", Icons.Default.Audiotrack, {
|
||||||
AttachmentOption("聯絡人", Icons.Default.ContactPage, onContactClick)
|
currentMenuTitle = "Audio" // 🎯 變更標題
|
||||||
|
onAudioClick()
|
||||||
|
}),
|
||||||
|
AttachmentOption("文件", Icons.Default.Description, {
|
||||||
|
currentMenuTitle = "Document" // 🎯 變更標題
|
||||||
|
onDocumentClick()
|
||||||
|
}),
|
||||||
|
AttachmentOption("位置", Icons.Default.LocationOn, {
|
||||||
|
currentMenuTitle = "Location" // 🎯 變更標題
|
||||||
|
onLocationClick()
|
||||||
|
}),
|
||||||
|
AttachmentOption("聯絡人", Icons.Default.ContactPage, {
|
||||||
|
currentMenuTitle = "Contact" // 🎯 變更標題
|
||||||
|
onContactClick()
|
||||||
|
})
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -167,7 +184,7 @@ fun MessageAttachmentBar(
|
||||||
horizontalArrangement = Arrangement.SpaceBetween
|
horizontalArrangement = Arrangement.SpaceBetween
|
||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
text = "Send Attachment",
|
text = "Send $currentMenuTitle",
|
||||||
style = MaterialTheme.typography.titleSmall,
|
style = MaterialTheme.typography.titleSmall,
|
||||||
color = Color.White,
|
color = Color.White,
|
||||||
fontWeight = FontWeight.Bold
|
fontWeight = FontWeight.Bold
|
||||||
|
|
@ -280,13 +297,6 @@ fun MessageAttachmentBar(
|
||||||
modifier = Modifier.size(20.dp)
|
modifier = Modifier.size(20.dp)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 功能文字
|
|
||||||
Text(
|
|
||||||
text = option.title,
|
|
||||||
color = Color.White.copy(alpha = 0.8f),
|
|
||||||
style = MaterialTheme.typography.labelSmall
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue