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:
+3
-4
@@ -22,6 +22,7 @@ package com.vitorpamplona.amethyst.ui.screen.loggedIn.nests.room
|
||||
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.ColumnScope
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
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.
|
||||
*/
|
||||
@Composable
|
||||
internal fun NestChatPanel(
|
||||
internal fun ColumnScope.NestChatPanel(
|
||||
event: MeetingSpaceEvent,
|
||||
viewModel: NestViewModel,
|
||||
accountViewModel: AccountViewModel,
|
||||
@@ -120,7 +121,7 @@ internal fun NestChatPanel(
|
||||
val routeForLastRead = remember(event) { "NestChat/${event.address().toValue()}" }
|
||||
|
||||
Column(modifier = modifier.fillMaxWidth()) {
|
||||
Box(modifier = Modifier.fillMaxWidth().height(NEST_CHAT_PANEL_HEIGHT)) {
|
||||
Box(modifier = Modifier.fillMaxWidth().weight(1f, fill = true)) {
|
||||
if (messages.isEmpty()) {
|
||||
Text(
|
||||
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 = {}
|
||||
|
||||
+24
-10
@@ -98,19 +98,20 @@ internal fun NestFullScreen(
|
||||
) {
|
||||
val roomTheme = androidx.compose.runtime.remember(event) { RoomTheme.from(event) }
|
||||
NestThemedScope(theme = roomTheme, accountViewModel = accountViewModel) {
|
||||
// Inset the room content inside the system bars so the title
|
||||
// doesn't slide under the status bar and the Leave / chat
|
||||
// composer don't sit beneath the gesture / nav bar. The
|
||||
// themed background color and `bg` image still paint
|
||||
// edge-to-edge — they live on NestThemedScope's outer Box,
|
||||
// which is intentionally outside this padding.
|
||||
// Outer column owns the safeDrawing inset; the top metadata
|
||||
// section and the chat panel are weighted siblings.
|
||||
//
|
||||
// The top section uses `weight(1f, fill = false)` so it never
|
||||
// exceeds half the screen and scrolls internally if it would.
|
||||
// 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(
|
||||
modifier =
|
||||
Modifier
|
||||
.fillMaxSize()
|
||||
.windowInsetsPadding(WindowInsets.safeDrawing)
|
||||
.padding(16.dp)
|
||||
.verticalScroll(rememberScrollState()),
|
||||
.windowInsetsPadding(WindowInsets.safeDrawing),
|
||||
) {
|
||||
var showEditSheet 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 leaveScope = rememberCoroutineScope()
|
||||
|
||||
Column(
|
||||
modifier =
|
||||
Modifier
|
||||
.weight(1f, fill = false)
|
||||
.verticalScroll(rememberScrollState())
|
||||
.padding(horizontal = 16.dp)
|
||||
.padding(top = 16.dp),
|
||||
) {
|
||||
Row(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
horizontalArrangement = Arrangement.SpaceBetween,
|
||||
@@ -332,12 +341,17 @@ internal fun NestFullScreen(
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
NestChatPanel(
|
||||
event = event,
|
||||
viewModel = viewModel,
|
||||
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),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user