Fix wrong message order and avatars

This commit is contained in:
2025-12-16 18:05:35 +03:00
Unverified
parent 25f2ebc67b
commit d2383415e3
2 changed files with 8 additions and 14 deletions
@@ -329,8 +329,7 @@ fun ChatScreen(
LazyColumn(
state = listState,
modifier = Modifier.fillMaxSize(), // Fill the entire space of the Box
verticalArrangement = Arrangement.spacedBy(4.dp, alignment = Alignment.Bottom),
reverseLayout = true // Display messages from bottom to top
verticalArrangement = Arrangement.spacedBy(4.dp, alignment = Alignment.Bottom)
) {
item { Spacer(Modifier.height(innerPadding.calculateBottomPadding())) } // Spacer for chat input
items(
@@ -81,6 +81,13 @@ fun MessageItem(
verticalAlignment = Alignment.Bottom
) {
if (!isAuthor) {
// Avatar at bottom
Avatar(
profilePictureUrl = message.profile_picture,
displayName = message.username,
size = 32.dp
)
Spacer(modifier = Modifier.width(8.dp))
}
@@ -196,18 +203,6 @@ fun MessageItem(
}
}
}
if (!isAuthor) {
Spacer(modifier = Modifier.width(8.dp))
// Avatar at bottom
Avatar(
profilePictureUrl = message.profile_picture,
displayName = message.username,
size = 32.dp
)
} else {
Spacer(modifier = Modifier.width(8.dp))
}
}
}
}