fix(nests): NestChatPanel takes weight(1) so chat fills the screen

Previously the room screen wrapped EVERYTHING — title, summary,
participants, talk row, action row, AND chat — in a single
verticalScroll Column. The chat panel sat at the bottom with a fixed
NEST_CHAT_PANEL_HEIGHT (420dp), which meant on tall phones the chat
left blank space below it and on small phones the chat was cramped.

Restructure NestFullScreen's body:
  - Outer Column.fillMaxSize, no scroll, owns safeDrawing inset.
  - Top metadata: Column with weight(1f, fill=false), internal
    verticalScroll, horizontal+top padding. Caps at half the screen
    so an over-tall participants list scrolls internally instead of
    pushing the chat off-screen.
  - NestChatPanel: Column-scoped weight(1f, fill=true), horizontal
    padding + bottom inset. Always takes its full allocation —
    chat dominates the screen, fixed-height fallback gone.

NestChatPanel is now a `ColumnScope.NestChatPanel` extension so its
modifier can use `weight()` from the caller. Inside the panel, the
message list Box also uses weight(1f, fill=true) of the panel's own
Column, so the LazyColumn fills everything except the composer.

NEST_CHAT_PANEL_HEIGHT constant removed — it was the source of the
fixed-height behavior the user explicitly didn't want.

https://claude.ai/code/session_01RDpuki4t8StSg1CZcXnV5b
This commit is contained in:
Claude
2026-04-27 20:31:08 +00:00
parent 7f48b18319
commit 84712f48f1
2 changed files with 225 additions and 212 deletions
@@ -22,6 +22,7 @@ package com.vitorpamplona.amethyst.ui.screen.loggedIn.nests.room
import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.ColumnScope
import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.fillMaxWidth
@@ -97,7 +98,7 @@ import kotlinx.coroutines.launch
* which are pinned to the channel-VM model — out of scope here. * which are pinned to the channel-VM model — out of scope here.
*/ */
@Composable @Composable
internal fun NestChatPanel( internal fun ColumnScope.NestChatPanel(
event: MeetingSpaceEvent, event: MeetingSpaceEvent,
viewModel: NestViewModel, viewModel: NestViewModel,
accountViewModel: AccountViewModel, accountViewModel: AccountViewModel,
@@ -120,7 +121,7 @@ internal fun NestChatPanel(
val routeForLastRead = remember(event) { "NestChat/${event.address().toValue()}" } val routeForLastRead = remember(event) { "NestChat/${event.address().toValue()}" }
Column(modifier = modifier.fillMaxWidth()) { Column(modifier = modifier.fillMaxWidth()) {
Box(modifier = Modifier.fillMaxWidth().height(NEST_CHAT_PANEL_HEIGHT)) { Box(modifier = Modifier.fillMaxWidth().weight(1f, fill = true)) {
if (messages.isEmpty()) { if (messages.isEmpty()) {
Text( Text(
text = stringRes(R.string.nest_chat_empty), text = stringRes(R.string.nest_chat_empty),
@@ -266,6 +267,4 @@ private fun NestChatComposer(
} }
} }
private val NEST_CHAT_PANEL_HEIGHT = 420.dp
private val NEST_CHAT_NO_OP_NOTE: (com.vitorpamplona.amethyst.model.Note) -> Unit = {} private val NEST_CHAT_NO_OP_NOTE: (com.vitorpamplona.amethyst.model.Note) -> Unit = {}
@@ -98,19 +98,20 @@ internal fun NestFullScreen(
) { ) {
val roomTheme = androidx.compose.runtime.remember(event) { RoomTheme.from(event) } val roomTheme = androidx.compose.runtime.remember(event) { RoomTheme.from(event) }
NestThemedScope(theme = roomTheme, accountViewModel = accountViewModel) { NestThemedScope(theme = roomTheme, accountViewModel = accountViewModel) {
// Inset the room content inside the system bars so the title // Outer column owns the safeDrawing inset; the top metadata
// doesn't slide under the status bar and the Leave / chat // section and the chat panel are weighted siblings.
// composer don't sit beneath the gesture / nav bar. The //
// themed background color and `bg` image still paint // The top section uses `weight(1f, fill = false)` so it never
// edge-to-edge — they live on NestThemedScope's outer Box, // exceeds half the screen and scrolls internally if it would.
// which is intentionally outside this padding. // The chat uses `weight(1f, fill = true)` so it always takes
// its full allocation — the user explicitly wanted chat to
// dominate the screen rather than ride a fixed-height box at
// the bottom of the metadata scroll.
Column( Column(
modifier = modifier =
Modifier Modifier
.fillMaxSize() .fillMaxSize()
.windowInsetsPadding(WindowInsets.safeDrawing) .windowInsetsPadding(WindowInsets.safeDrawing),
.padding(16.dp)
.verticalScroll(rememberScrollState()),
) { ) {
var showEditSheet by rememberSaveable { mutableStateOf(false) } var showEditSheet by rememberSaveable { mutableStateOf(false) }
var showHostMenu by rememberSaveable { mutableStateOf(false) } var showHostMenu by rememberSaveable { mutableStateOf(false) }
@@ -118,6 +119,14 @@ internal fun NestFullScreen(
val isHost = accountViewModel.account.signer.pubKey == event.pubKey val isHost = accountViewModel.account.signer.pubKey == event.pubKey
val leaveScope = rememberCoroutineScope() val leaveScope = rememberCoroutineScope()
Column(
modifier =
Modifier
.weight(1f, fill = false)
.verticalScroll(rememberScrollState())
.padding(horizontal = 16.dp)
.padding(top = 16.dp),
) {
Row( Row(
modifier = Modifier.fillMaxWidth(), modifier = Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.SpaceBetween, horizontalArrangement = Arrangement.SpaceBetween,
@@ -332,12 +341,17 @@ internal fun NestFullScreen(
}, },
) )
} }
}
NestChatPanel( NestChatPanel(
event = event, event = event,
viewModel = viewModel, viewModel = viewModel,
accountViewModel = accountViewModel, accountViewModel = accountViewModel,
modifier = Modifier.padding(top = 12.dp), modifier =
Modifier
.weight(1f, fill = true)
.padding(horizontal = 16.dp)
.padding(top = 12.dp, bottom = 16.dp),
) )
} }
} }