This commit is contained in:
spaced4ndy
2026-07-31 17:59:58 +04:00
parent b66cc394b1
commit f2e628e4de
2 changed files with 13 additions and 18 deletions
@@ -12,6 +12,7 @@ import androidx.compose.ui.draw.clip
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.layout.Layout
import androidx.compose.ui.layout.onSizeChanged
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextOverflow
@@ -50,11 +51,9 @@ fun SupportSimpleXBanner(onTap: () -> Unit, onDismiss: () -> Unit) {
var cardSize by remember { mutableStateOf(IntSize.Zero) }
val brush = remember(isDark, cardSize) { gradientBrush(isDark, cardSize) }
// Two-Box structure so text can grow (2-line wrapping at large fonts) while X stays anchored to
// the card's top-right, not the outer wrapper's top-right (which would drift up into hero overhang).
// Outer Box takes max(inner card, hero); inner Box wraps the card Row + X together and aligns to
// Outer bottom so hero overhangs above.
Box(Modifier.fillMaxWidth(), contentAlignment = Alignment.BottomStart) {
// Layout sizes to the card; hero is placed at y = cardHeight - heroHeight (negative → hero
// overhangs above card at normal fonts, 0/positive → hero fits inside card at large fonts).
Layout(content = {
Box(Modifier.fillMaxWidth()) {
Row(
Modifier
@@ -117,8 +116,15 @@ fun SupportSimpleXBanner(onTap: () -> Unit, onDismiss: () -> Unit) {
heroVisibleHeight = heroVisibleHeight,
cardHeight = cardHeight,
trailingPadding = heroTrailingPadding,
modifier = Modifier.align(Alignment.BottomEnd)
modifier = Modifier
)
}) { measurables, constraints ->
val cardPlaceable = measurables[0].measure(constraints)
val heroPlaceable = measurables[1].measure(constraints.copy(minWidth = 0, minHeight = 0))
layout(cardPlaceable.width, cardPlaceable.height) {
cardPlaceable.place(0, 0)
heroPlaceable.place(cardPlaceable.width - heroPlaceable.width, cardPlaceable.height - heroPlaceable.height)
}
}
}
@@ -1005,18 +1005,7 @@ private fun BoxScope.ChatList(searchText: MutableState<TextFieldValue>, listStat
// so this still needs 3 real conversations.
if (!supporterBannerShown.value && chatModel.chats.value.size > 3) {
item {
// Only hero's above-card extension overhangs, so card background never bleeds up at large fonts.
val overhang = (108.dp - (72.dp * fontSizeMultiplier)).coerceIn(0.dp, 24.dp)
Box(
Modifier
.layout { measurable, constraints ->
val dy = overhang.roundToPx()
val p = measurable.measure(constraints)
layout(p.width, (p.height - dy).coerceAtLeast(0)) { p.place(0, -dy) }
}
.zIndex(1f)
.padding(start = 16.dp, end = 16.dp, bottom = 16.dp)
) {
Box(Modifier.zIndex(1f).padding(16.dp)) {
SupportSimpleXBanner(
onTap = { ModalManager.start.showModal { BadgesSupportSimplexView() } },
onDismiss = { appPrefs.supporterBannerShown.set(true) }