dm-80
This commit is contained in:
parent
8e07fbd4b2
commit
ef75829e4d
1 changed files with 62 additions and 29 deletions
|
|
@ -3,11 +3,18 @@ package com.example.login_v3.home.Message.UI.Detail.Message_Messaging_detail
|
||||||
import androidx.compose.foundation.clickable
|
import androidx.compose.foundation.clickable
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
|
import androidx.compose.foundation.layout.Column
|
||||||
|
import androidx.compose.foundation.layout.PaddingValues
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
|
import androidx.compose.foundation.layout.aspectRatio
|
||||||
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.height
|
import androidx.compose.foundation.layout.height
|
||||||
import androidx.compose.foundation.layout.navigationBarsPadding
|
import androidx.compose.foundation.layout.navigationBarsPadding
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
|
import androidx.compose.foundation.lazy.grid.GridCells
|
||||||
|
import androidx.compose.foundation.lazy.grid.LazyVerticalGrid
|
||||||
|
import androidx.compose.foundation.lazy.grid.items
|
||||||
import androidx.compose.foundation.shape.CircleShape
|
import androidx.compose.foundation.shape.CircleShape
|
||||||
import androidx.compose.material3.Surface
|
import androidx.compose.material3.Surface
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
|
|
@ -17,6 +24,7 @@ import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.draw.clip
|
import androidx.compose.ui.draw.clip
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.unit.sp
|
import androidx.compose.ui.unit.sp
|
||||||
|
|
||||||
|
|
@ -26,54 +34,79 @@ fun MessageEmojiBar(
|
||||||
onCancel: () -> Unit,
|
onCancel: () -> Unit,
|
||||||
modifier: Modifier = Modifier
|
modifier: Modifier = Modifier
|
||||||
) {
|
) {
|
||||||
|
// 這裡可以無限塞入幾百個 Emoji 都沒問題了!
|
||||||
val emojiList = remember {
|
val emojiList = remember {
|
||||||
listOf(
|
listOf(
|
||||||
"👍", "❤️", "😂", "😮", "😢", "🙏",
|
"👍", "❤️", "😂", "😮", "😢", "🙏",
|
||||||
"🔥", "🎉", "👏", "👀", "✨", "💯",
|
"🔥", "🎉", "👏", "👀", "✨", "💯",
|
||||||
"🤔", "🥳", "😎", "🚀", "💔", "💩"
|
"🤔", "🥳", "😎", "🚀", "💔", "💩",
|
||||||
|
"🤩", "🤯", "🙄", "🤫", "😴", "🤤",
|
||||||
|
"😭", "😡", "🤡", "👻", "👽", "🤖",
|
||||||
|
"👑", "🦄", "🐾", "🍕", "🍺", "☕️"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
Surface(
|
Surface(
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.height(300.dp)
|
.height(300.dp), // 保持你設定的 300.dp 固定高度
|
||||||
,
|
color = Color(0xFFF5F5F5),
|
||||||
color = Color(0xFFF5F5F5), // 稍微與純白底色做點區隔,可自行調整
|
|
||||||
tonalElevation = 4.dp
|
tonalElevation = 4.dp
|
||||||
) {
|
) {
|
||||||
Row(
|
Column(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.navigationBarsPadding() // 避免被手機底部的導覽橫條遮擋
|
.navigationBarsPadding() // 確保不被系統海苔條遮擋
|
||||||
.padding(horizontal = 16.dp, vertical = 12.dp),
|
.padding(horizontal = 16.dp, vertical = 12.dp)
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
|
||||||
horizontalArrangement = Arrangement.SpaceBetween
|
|
||||||
) {
|
) {
|
||||||
// 左側:Emoji 點擊區
|
// 【頂部功能列】:左邊放個小提示,右邊放關閉按鈕
|
||||||
Row(
|
Row(
|
||||||
horizontalArrangement = Arrangement.spacedBy(16.dp),
|
modifier = Modifier
|
||||||
modifier = Modifier.weight(1f)
|
.fillMaxWidth()
|
||||||
|
.padding(bottom = 8.dp),
|
||||||
|
horizontalArrangement = Arrangement.SpaceBetween,
|
||||||
|
verticalAlignment = Alignment.CenterVertically
|
||||||
) {
|
) {
|
||||||
emojiList.forEach { emoji ->
|
Text(
|
||||||
Text(
|
text = "傳送回應",
|
||||||
text = emoji,
|
fontSize = 14.sp,
|
||||||
fontSize = 26.sp,
|
fontWeight = FontWeight.Bold,
|
||||||
modifier = Modifier
|
color = Color.Gray
|
||||||
.clip(CircleShape)
|
)
|
||||||
.clickable { onEmojiClick(emoji) }
|
|
||||||
.padding(4.dp)
|
// 關閉按鈕
|
||||||
)
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.clip(CircleShape)
|
||||||
|
.clickable { onCancel() }
|
||||||
|
.padding(8.dp),
|
||||||
|
contentAlignment = Alignment.Center
|
||||||
|
) {
|
||||||
|
Text(text = "✕", color = Color.Gray, fontSize = 16.sp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 右側:關閉按鈕 (Icon 可以換成你專案內現有的)
|
// 【核心改動】:使用網格佈局,塞再多都不怕!
|
||||||
Box(
|
LazyVerticalGrid(
|
||||||
modifier = Modifier
|
columns = GridCells.Fixed(6),
|
||||||
.clip(CircleShape)
|
modifier = Modifier.fillMaxSize(),
|
||||||
.clickable { onCancel() }
|
horizontalArrangement = Arrangement.spacedBy(12.dp),
|
||||||
.padding(4.dp)
|
verticalArrangement = Arrangement.spacedBy(12.dp),
|
||||||
|
contentPadding = PaddingValues(bottom = 8.dp)
|
||||||
) {
|
) {
|
||||||
Text(text = "✕", color = Color.Gray, fontSize = 18.sp)
|
items(emojiList) { emoji ->
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.aspectRatio(1f) // 讓每個格子都是正方形,比較好對齊
|
||||||
|
.clip(CircleShape)
|
||||||
|
.clickable { onEmojiClick(emoji) },
|
||||||
|
contentAlignment = Alignment.Center
|
||||||
|
) {
|
||||||
|
Text(
|
||||||
|
text = emoji,
|
||||||
|
fontSize = 28.sp // 稍微放大一點點,比較好點擊
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue