feat(chat): implement FloatingChatWidget entry point and dialog popup
This commit is contained in:
parent
338ecdfd43
commit
1cf1ffd9e8
|
|
@ -0,0 +1,59 @@
|
|||
package com.stand.standapp.ui.chat
|
||||
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.shape.CircleShape
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material3.*
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.draw.shadow
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.window.Popup
|
||||
import androidx.compose.ui.window.PopupProperties
|
||||
import com.stand.standapp.ui.chat.components.ChatScaffold
|
||||
|
||||
@Composable
|
||||
fun FloatingChatWidget() {
|
||||
var isExpanded by remember { mutableStateOf(false) }
|
||||
|
||||
Box(modifier = Modifier.fillMaxSize()) {
|
||||
// 右下角悬浮按钮
|
||||
if (!isExpanded) {
|
||||
FloatingActionButton(
|
||||
onClick = { isExpanded = true },
|
||||
modifier = Modifier
|
||||
.align(Alignment.BottomEnd)
|
||||
.padding(16.dp)
|
||||
.padding(bottom = 32.dp), // 留出导航栏空间
|
||||
containerColor = Color(0xFF10B981)
|
||||
) {
|
||||
Text("AI", color = Color.White, style = MaterialTheme.typography.titleMedium)
|
||||
}
|
||||
}
|
||||
|
||||
// 弹出的对话卡片
|
||||
if (isExpanded) {
|
||||
Popup(
|
||||
alignment = Alignment.BottomEnd,
|
||||
properties = PopupProperties(focusable = true)
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.padding(16.dp)
|
||||
.padding(bottom = 32.dp)
|
||||
.width(340.dp) // 限定卡片宽度
|
||||
.height(500.dp) // 限定卡片高度
|
||||
.shadow(8.dp, RoundedCornerShape(16.dp))
|
||||
.clip(RoundedCornerShape(16.dp))
|
||||
) {
|
||||
ChatScaffold(
|
||||
onClose = { isExpanded = false }
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue