This commit is contained in:
Eric85710 2026-06-10 16:18:16 +08:00
parent dfe949abf3
commit 23a217ee92
2 changed files with 101 additions and 109 deletions

View file

@ -228,7 +228,7 @@ fun MessageMessaging(
verticalAlignment = Alignment.CenterVertically, verticalAlignment = Alignment.CenterVertically,
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxWidth()
.height(56.dp) // 👈 固定標準的 TopAppBar 高度,不會再扁扁一條了! .height(58.dp) // 👈 固定標準的 TopAppBar 高度,不會再扁扁一條了!
.padding(horizontal = 12.dp) // 側邊留點呼吸空間 .padding(horizontal = 12.dp) // 側邊留點呼吸空間
) { ) {
// 如果你想加返回按鈕,可以加在這裡 // 如果你想加返回按鈕,可以加在這裡
@ -237,7 +237,7 @@ fun MessageMessaging(
if (currentState is MessagesUiState.Success) { if (currentState is MessagesUiState.Success) {
UserAvatar( UserAvatar(
avatarUrl = currentState.partnerAvatarUrl, avatarUrl = currentState.partnerAvatarUrl,
modifier = Modifier.size(36.dp) modifier = Modifier.size(42.dp)
) )
} }
@ -246,10 +246,14 @@ fun MessageMessaging(
Text( Text(
text = topBarTitle, text = topBarTitle,
style = MaterialTheme.typography.titleMedium, style = MaterialTheme.typography.titleMedium,
color = Color.Black fontSize = 24.sp, // 👈 直接在這裡設定你想要的 sp 大小
fontWeight = FontWeight.Bold,
color = Color(0xFF333333),
maxLines = 1,
overflow = TextOverflow.Ellipsis
) )
Spacer(modifier = Modifier.width(8.dp)) Spacer(modifier = Modifier.width(12.dp))
if (currentState is MessagesUiState.Success) { if (currentState is MessagesUiState.Success) {
if (currentState.partnerStatus == UserStatus.ONLINE) { if (currentState.partnerStatus == UserStatus.ONLINE) {

View file

@ -229,28 +229,17 @@ fun RoomItem(
val title = room.displayTitle val title = room.displayTitle
with(sharedTransitionScope){ with(sharedTransitionScope){
Card( Box(
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxWidth()
.padding(horizontal = 12.dp, vertical = 6.dp) .padding(horizontal = 12.dp, vertical = 6.dp)
.clickable { onClick(room.roomId, room.displayTitle) } // 1. 先處理轉場動畫(確保容器變形基底乾淨)
// 🌟 關鍵:把共享元素鎖定在整個外層 Container 上!
.sharedElement( .sharedElement(
rememberSharedContentState(key = "container_${room.roomId}"), rememberSharedContentState(key = "container_${room.roomId}"),
animatedVisibilityScope = animatedVisibilityScope animatedVisibilityScope = animatedVisibilityScope
) )
, // 2. 再綁定點擊事件
shape = RoundedCornerShape(16.dp), // 較大的圓角看起來更現代 .clickable { onClick(room.roomId, room.displayTitle) }
colors = CardDefaults.cardColors(
containerColor = Color.Transparent // ✅ 透明背景
),
elevation = CardDefaults.cardElevation(
defaultElevation = 0.dp // 增加輕微陰影
)
) {
Box(
modifier = Modifier
.fillMaxSize()
){ ){
//glass effect //glass effect
Box( Box(
@ -363,7 +352,6 @@ fun RoomItem(
} }
}
} }
} }