Merge pull request #142 from hector6872/fix/messages-list-content-padding

Fix content padding in messages list
This commit is contained in:
callebtc
2025-07-19 09:47:00 +02:00
committed by GitHub
3 changed files with 18 additions and 22 deletions
@@ -48,7 +48,6 @@ import java.util.*
* - DialogComponents: Password prompts and modals * - DialogComponents: Password prompts and modals
* - ChatUIUtils: Utility functions for formatting and colors * - ChatUIUtils: Utility functions for formatting and colors
*/ */
@OptIn(ExperimentalMaterial3Api::class)
@Composable @Composable
fun ChatScreen(viewModel: ChatViewModel) { fun ChatScreen(viewModel: ChatViewModel) {
val colorScheme = MaterialTheme.colorScheme val colorScheme = MaterialTheme.colorScheme
@@ -88,7 +87,7 @@ fun ChatScreen(viewModel: ChatViewModel) {
} }
// Use WindowInsets to handle keyboard properly // Use WindowInsets to handle keyboard properly
BoxWithConstraints(modifier = Modifier.fillMaxSize()) { Box(modifier = Modifier.fillMaxSize()) {
val headerHeight = 36.dp val headerHeight = 36.dp
// Main content area that responds to keyboard/window insets // Main content area that responds to keyboard/window insets
@@ -102,14 +101,12 @@ fun ChatScreen(viewModel: ChatViewModel) {
Spacer(modifier = Modifier.height(headerHeight)) Spacer(modifier = Modifier.height(headerHeight))
// Messages area - takes up available space, will compress when keyboard appears // Messages area - takes up available space, will compress when keyboard appears
Box(modifier = Modifier.weight(1f)) { MessagesList(
MessagesList( messages = displayMessages,
messages = displayMessages, currentUserNickname = nickname,
currentUserNickname = nickname, meshService = viewModel.meshService,
meshService = viewModel.meshService, modifier = Modifier.weight(1f)
modifier = Modifier.fillMaxSize() )
)
}
// Input area - stays at bottom // Input area - stays at bottom
ChatInputSection( ChatInputSection(
@@ -198,7 +195,6 @@ fun ChatScreen(viewModel: ChatViewModel) {
) )
} }
@OptIn(ExperimentalMaterial3Api::class)
@Composable @Composable
private fun ChatInputSection( private fun ChatInputSection(
messageText: TextFieldValue, messageText: TextFieldValue,
@@ -218,7 +214,7 @@ private fun ChatInputSection(
shadowElevation = 8.dp shadowElevation = 8.dp
) { ) {
Column { Column {
Divider(color = colorScheme.outline.copy(alpha = 0.3f)) HorizontalDivider(color = colorScheme.outline.copy(alpha = 0.3f))
// Command suggestions box // Command suggestions box
if (showCommandSuggestions && commandSuggestions.isNotEmpty()) { if (showCommandSuggestions && commandSuggestions.isNotEmpty()) {
@@ -228,7 +224,7 @@ private fun ChatInputSection(
modifier = Modifier.fillMaxWidth() modifier = Modifier.fillMaxWidth()
) )
Divider(color = colorScheme.outline.copy(alpha = 0.2f)) HorizontalDivider(color = colorScheme.outline.copy(alpha = 0.2f))
} }
MessageInput( MessageInput(
@@ -291,12 +287,12 @@ private fun ChatFloatingHeader(
} }
// Divider under header // Divider under header
Divider( HorizontalDivider(
color = colorScheme.outline.copy(alpha = 0.3f),
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxWidth()
.offset(y = headerHeight) .offset(y = headerHeight)
.zIndex(1f) .zIndex(1f),
color = colorScheme.outline.copy(alpha = 0.3f)
) )
} }
@@ -42,10 +42,10 @@ fun MessagesList(
} }
} }
SelectionContainer { SelectionContainer(modifier = modifier) {
LazyColumn( LazyColumn(
state = listState, state = listState,
modifier = modifier.padding(horizontal = 12.dp, vertical = 8.dp), contentPadding = PaddingValues(horizontal = 12.dp, vertical = 8.dp),
verticalArrangement = Arrangement.spacedBy(2.dp) verticalArrangement = Arrangement.spacedBy(2.dp)
) { ) {
items(messages) { message -> items(messages) { message ->
@@ -74,7 +74,7 @@ fun SidebarOverlay(
) { ) {
SidebarHeader() SidebarHeader()
Divider() HorizontalDivider()
// Scrollable content // Scrollable content
LazyColumn( LazyColumn(
@@ -101,7 +101,7 @@ fun SidebarOverlay(
} }
item { item {
Divider(modifier = Modifier.padding(vertical = 4.dp)) HorizontalDivider(modifier = Modifier.padding(vertical = 4.dp))
} }
} }