调整聊天界面的边距
This commit is contained in:
@@ -51,6 +51,7 @@ import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.focus.onFocusChanged
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.ColorFilter
|
||||
import androidx.compose.ui.input.pointer.pointerInput
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.platform.LocalDensity
|
||||
@@ -133,7 +134,7 @@ fun ChatScreen(userId: String) {
|
||||
Image(
|
||||
painter = painterResource(R.drawable.rider_pro_nav_back),
|
||||
modifier = Modifier
|
||||
.size(36.dp)
|
||||
.size(28.dp)
|
||||
.noRippleClickable {
|
||||
navController.popBackStack()
|
||||
},
|
||||
@@ -237,11 +238,11 @@ fun ChatSelfItem(item: ChatItem) {
|
||||
Spacer(modifier = Modifier.height(4.dp))
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.widthIn(min = 20.dp, max = 250.dp)
|
||||
.widthIn(min = 20.dp, max = (if (item.messageType == V2TIMMessage.V2TIM_ELEM_TYPE_TEXT) 250.dp else 150.dp))
|
||||
.clip(RoundedCornerShape(8.dp))
|
||||
.background(Color(0xFF000000))
|
||||
.padding(vertical = 8.dp, horizontal = 16.dp)
|
||||
.padding(bottom = 3.dp)
|
||||
.padding(vertical = (if (item.messageType == V2TIMMessage.V2TIM_ELEM_TYPE_TEXT) 8.dp else 0.dp), horizontal = (if (item.messageType == V2TIMMessage.V2TIM_ELEM_TYPE_TEXT) 16.dp else 0.dp))
|
||||
.padding(bottom = (if (item.messageType == V2TIMMessage.V2TIM_ELEM_TYPE_TEXT) 3.dp else 0.dp))
|
||||
) {
|
||||
when (item.messageType) {
|
||||
V2TIMMessage.V2TIM_ELEM_TYPE_TEXT -> {
|
||||
@@ -333,11 +334,11 @@ fun ChatOtherItem(item: ChatItem) {
|
||||
Spacer(modifier = Modifier.height(4.dp))
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.widthIn(min = 20.dp, max = 250.dp)
|
||||
.widthIn(min = 20.dp, max = (if (item.messageType == V2TIMMessage.V2TIM_ELEM_TYPE_TEXT) 250.dp else 150.dp))
|
||||
.clip(RoundedCornerShape(8.dp))
|
||||
.background(Color(0xffFFFFFF))
|
||||
.padding(vertical = 8.dp, horizontal = 16.dp)
|
||||
.padding(bottom = 3.dp)
|
||||
.padding(vertical = (if (item.messageType == V2TIMMessage.V2TIM_ELEM_TYPE_TEXT) 8.dp else 0.dp), horizontal = (if (item.messageType == V2TIMMessage.V2TIM_ELEM_TYPE_TEXT) 16.dp else 0.dp))
|
||||
.padding(bottom = (if (item.messageType == V2TIMMessage.V2TIM_ELEM_TYPE_TEXT) 3.dp else 0.dp))
|
||||
) {
|
||||
when (item.messageType) {
|
||||
V2TIMMessage.V2TIM_ELEM_TYPE_TEXT -> {
|
||||
@@ -441,7 +442,7 @@ fun ChatInput(
|
||||
.clip(RoundedCornerShape(16.dp))
|
||||
.background(Color(0xffe5e5e5))
|
||||
.padding(horizontal = 16.dp),
|
||||
contentAlignment = androidx.compose.ui.Alignment.CenterStart
|
||||
contentAlignment = androidx.compose.ui.Alignment.CenterStart,
|
||||
) {
|
||||
BasicTextField(
|
||||
value = text,
|
||||
@@ -476,10 +477,10 @@ fun ChatInput(
|
||||
}
|
||||
Spacer(modifier = Modifier.width(16.dp))
|
||||
Icon(
|
||||
painter = painterResource(id = R.drawable.rider_pro_images),
|
||||
painter = painterResource(id = R.drawable.rider_pro_camera),
|
||||
contentDescription = "Emoji",
|
||||
modifier = Modifier
|
||||
.size(32.dp)
|
||||
.size(30.dp)
|
||||
.noRippleClickable {
|
||||
imagePickUpLauncher.launch(
|
||||
Intent.createChooser(
|
||||
@@ -490,17 +491,15 @@ fun ChatInput(
|
||||
)
|
||||
)
|
||||
},
|
||||
tint = Color(0xff000000)
|
||||
tint = Color(0xffe0e0e0)
|
||||
)
|
||||
Spacer(modifier = Modifier.width(8.dp))
|
||||
Crossfade(targetState = text.isNotEmpty(), animationSpec = tween(500)) { isNotEmpty ->
|
||||
Image(
|
||||
painter = rememberUpdatedState(
|
||||
if (isNotEmpty) painterResource(id = R.drawable.rider_pro_send) else painterResource(
|
||||
id = R.drawable.rider_pro_send_disable
|
||||
)
|
||||
).value,
|
||||
contentDescription = "Send",
|
||||
Crossfade(targetState = text.isNotEmpty(), animationSpec = tween(500),
|
||||
label = ""
|
||||
) { isNotEmpty ->
|
||||
Icon(
|
||||
painter = painterResource(id = R.drawable.rider_pro_video_share),
|
||||
contentDescription = "Emoji",
|
||||
modifier = Modifier
|
||||
.size(32.dp)
|
||||
.noRippleClickable {
|
||||
@@ -509,6 +508,7 @@ fun ChatInput(
|
||||
text = ""
|
||||
}
|
||||
},
|
||||
tint = if (isNotEmpty) Color.Red else Color(0xffe0e0e0)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user