fix: adjust padding in MessageBubble for consistent vertical spacing
This commit is contained in:
@@ -1066,24 +1066,6 @@ fun ChatsListScreen(
|
||||
}
|
||||
}
|
||||
} // Close ModalNavigationDrawer
|
||||
|
||||
// 🔥 Прозрачная зона слева для открытия drawer свайпом
|
||||
// Расположена ПОВЕРХ всего контента
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.fillMaxHeight()
|
||||
.width(40.dp)
|
||||
.align(Alignment.CenterStart)
|
||||
.pointerInput(drawerState) {
|
||||
detectHorizontalDragGestures(
|
||||
onHorizontalDrag = { _, dragAmount ->
|
||||
if (dragAmount > 5) {
|
||||
scope.launch { drawerState.open() }
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
)
|
||||
|
||||
// 🔥 Confirmation Dialogs
|
||||
|
||||
@@ -1607,22 +1589,37 @@ fun SwipeableDialogItem(
|
||||
.offset { IntOffset(animatedOffsetX.toInt(), 0) }
|
||||
.background(backgroundColor)
|
||||
.pointerInput(Unit) {
|
||||
detectHorizontalDragGestures(
|
||||
onDragEnd = {
|
||||
// Если свайпнули больше чем на половину - фиксируем
|
||||
if (kotlin.math.abs(offsetX) > swipeWidthPx / 2) {
|
||||
offsetX = -swipeWidthPx
|
||||
} else {
|
||||
offsetX = 0f
|
||||
}
|
||||
},
|
||||
onDragCancel = { offsetX = 0f },
|
||||
onHorizontalDrag = { _, dragAmount ->
|
||||
// Только свайп влево (отрицательное значение)
|
||||
val newOffset = offsetX + dragAmount
|
||||
offsetX = newOffset.coerceIn(-swipeWidthPx, 0f)
|
||||
val edgeZone = 50.dp.toPx() // Зона для drawer
|
||||
awaitEachGesture {
|
||||
val down = awaitFirstDown(requireUnconsumed = false)
|
||||
val startX = down.position.x
|
||||
|
||||
// 🔥 Если касание в левой зоне - НЕ захватываем pointer
|
||||
// Пусть ModalNavigationDrawer обработает
|
||||
if (startX < edgeZone) {
|
||||
return@awaitEachGesture
|
||||
}
|
||||
)
|
||||
|
||||
// Обрабатываем swipe-to-delete только для остальной части
|
||||
try {
|
||||
horizontalDrag(down.id) { change ->
|
||||
val dragAmount = change.positionChange().x
|
||||
// Только свайп влево
|
||||
val newOffset = offsetX + dragAmount
|
||||
offsetX = newOffset.coerceIn(-swipeWidthPx, 0f)
|
||||
change.consume()
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
offsetX = 0f
|
||||
}
|
||||
|
||||
// onDragEnd
|
||||
if (kotlin.math.abs(offsetX) > swipeWidthPx / 2) {
|
||||
offsetX = -swipeWidthPx
|
||||
} else {
|
||||
offsetX = 0f
|
||||
}
|
||||
}
|
||||
}
|
||||
) {
|
||||
DialogItemContent(
|
||||
|
||||
@@ -405,15 +405,11 @@ fun MessageBubble(
|
||||
val combinedBackgroundColor =
|
||||
if (isSelected) selectionBackgroundColor else highlightBackgroundColor
|
||||
|
||||
// 🔥 Telegram-style отступы: минимальные внутри группы, чуть больше между группами
|
||||
val topPadding = if (isGroupStart) 6.dp else 1.dp
|
||||
val bottomPadding = 1.dp
|
||||
|
||||
Row(
|
||||
modifier =
|
||||
Modifier.fillMaxWidth()
|
||||
.background(combinedBackgroundColor)
|
||||
.padding(top = topPadding, bottom = bottomPadding)
|
||||
.padding(vertical = 2.dp)
|
||||
.offset { IntOffset(animatedOffset.toInt(), 0) },
|
||||
horizontalArrangement = Arrangement.Start,
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
|
||||
Reference in New Issue
Block a user