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
* - ChatUIUtils: Utility functions for formatting and colors
*/
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun ChatScreen(viewModel: ChatViewModel) {
val colorScheme = MaterialTheme.colorScheme
@@ -88,7 +87,7 @@ fun ChatScreen(viewModel: ChatViewModel) {
}
// Use WindowInsets to handle keyboard properly
BoxWithConstraints(modifier = Modifier.fillMaxSize()) {
Box(modifier = Modifier.fillMaxSize()) {
val headerHeight = 36.dp
// Main content area that responds to keyboard/window insets
@@ -102,14 +101,12 @@ fun ChatScreen(viewModel: ChatViewModel) {
Spacer(modifier = Modifier.height(headerHeight))
// Messages area - takes up available space, will compress when keyboard appears
Box(modifier = Modifier.weight(1f)) {
MessagesList(
messages = displayMessages,
currentUserNickname = nickname,
meshService = viewModel.meshService,
modifier = Modifier.fillMaxSize()
)
}
MessagesList(
messages = displayMessages,
currentUserNickname = nickname,
meshService = viewModel.meshService,
modifier = Modifier.weight(1f)
)
// Input area - stays at bottom
ChatInputSection(
@@ -198,7 +195,6 @@ fun ChatScreen(viewModel: ChatViewModel) {
)
}
@OptIn(ExperimentalMaterial3Api::class)
@Composable
private fun ChatInputSection(
messageText: TextFieldValue,
@@ -218,7 +214,7 @@ private fun ChatInputSection(
shadowElevation = 8.dp
) {
Column {
Divider(color = colorScheme.outline.copy(alpha = 0.3f))
HorizontalDivider(color = colorScheme.outline.copy(alpha = 0.3f))
// Command suggestions box
if (showCommandSuggestions && commandSuggestions.isNotEmpty()) {
@@ -227,8 +223,8 @@ private fun ChatInputSection(
onSuggestionClick = onSuggestionClick,
modifier = Modifier.fillMaxWidth()
)
Divider(color = colorScheme.outline.copy(alpha = 0.2f))
HorizontalDivider(color = colorScheme.outline.copy(alpha = 0.2f))
}
MessageInput(
@@ -291,12 +287,12 @@ private fun ChatFloatingHeader(
}
// Divider under header
Divider(
color = colorScheme.outline.copy(alpha = 0.3f),
HorizontalDivider(
modifier = Modifier
.fillMaxWidth()
.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(
state = listState,
modifier = modifier.padding(horizontal = 12.dp, vertical = 8.dp),
contentPadding = PaddingValues(horizontal = 12.dp, vertical = 8.dp),
verticalArrangement = Arrangement.spacedBy(2.dp)
) {
items(messages) { message ->
@@ -73,8 +73,8 @@ fun SidebarOverlay(
.windowInsetsPadding(WindowInsets.statusBars) // Add status bar padding
) {
SidebarHeader()
Divider()
HorizontalDivider()
// Scrollable content
LazyColumn(
@@ -101,7 +101,7 @@ fun SidebarOverlay(
}
item {
Divider(modifier = Modifier.padding(vertical = 4.dp))
HorizontalDivider(modifier = Modifier.padding(vertical = 4.dp))
}
}