fix: adjust padding in MessageBubble for consistent vertical spacing
This commit is contained in:
@@ -1067,24 +1067,6 @@ fun ChatsListScreen(
|
|||||||
}
|
}
|
||||||
} // Close ModalNavigationDrawer
|
} // 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
|
// 🔥 Confirmation Dialogs
|
||||||
|
|
||||||
// Delete Dialog Confirmation
|
// Delete Dialog Confirmation
|
||||||
@@ -1607,22 +1589,37 @@ fun SwipeableDialogItem(
|
|||||||
.offset { IntOffset(animatedOffsetX.toInt(), 0) }
|
.offset { IntOffset(animatedOffsetX.toInt(), 0) }
|
||||||
.background(backgroundColor)
|
.background(backgroundColor)
|
||||||
.pointerInput(Unit) {
|
.pointerInput(Unit) {
|
||||||
detectHorizontalDragGestures(
|
val edgeZone = 50.dp.toPx() // Зона для drawer
|
||||||
onDragEnd = {
|
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) {
|
if (kotlin.math.abs(offsetX) > swipeWidthPx / 2) {
|
||||||
offsetX = -swipeWidthPx
|
offsetX = -swipeWidthPx
|
||||||
} else {
|
} else {
|
||||||
offsetX = 0f
|
offsetX = 0f
|
||||||
}
|
}
|
||||||
},
|
|
||||||
onDragCancel = { offsetX = 0f },
|
|
||||||
onHorizontalDrag = { _, dragAmount ->
|
|
||||||
// Только свайп влево (отрицательное значение)
|
|
||||||
val newOffset = offsetX + dragAmount
|
|
||||||
offsetX = newOffset.coerceIn(-swipeWidthPx, 0f)
|
|
||||||
}
|
}
|
||||||
)
|
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
DialogItemContent(
|
DialogItemContent(
|
||||||
|
|||||||
@@ -405,15 +405,11 @@ fun MessageBubble(
|
|||||||
val combinedBackgroundColor =
|
val combinedBackgroundColor =
|
||||||
if (isSelected) selectionBackgroundColor else highlightBackgroundColor
|
if (isSelected) selectionBackgroundColor else highlightBackgroundColor
|
||||||
|
|
||||||
// 🔥 Telegram-style отступы: минимальные внутри группы, чуть больше между группами
|
|
||||||
val topPadding = if (isGroupStart) 6.dp else 1.dp
|
|
||||||
val bottomPadding = 1.dp
|
|
||||||
|
|
||||||
Row(
|
Row(
|
||||||
modifier =
|
modifier =
|
||||||
Modifier.fillMaxWidth()
|
Modifier.fillMaxWidth()
|
||||||
.background(combinedBackgroundColor)
|
.background(combinedBackgroundColor)
|
||||||
.padding(top = topPadding, bottom = bottomPadding)
|
.padding(vertical = 2.dp)
|
||||||
.offset { IntOffset(animatedOffset.toInt(), 0) },
|
.offset { IntOffset(animatedOffset.toInt(), 0) },
|
||||||
horizontalArrangement = Arrangement.Start,
|
horizontalArrangement = Arrangement.Start,
|
||||||
verticalAlignment = Alignment.CenterVertically
|
verticalAlignment = Alignment.CenterVertically
|
||||||
|
|||||||
Reference in New Issue
Block a user