I don't know if this is a BUG or deliberately. Whe...
# compose
r
I don't know if this is a BUG or deliberately. When the horizontal arrangement of Row is set to "END", Compose still measures the layout from left to right.
my code:
Copy code
Row(
            modifier = Modifier
                .fillMaxWidth()
                .padding(8.dp), horizontalArrangement = Arrangement.End
        ) {
            Column(
                modifier = Modifier.padding(8.dp),
                horizontalAlignment = Alignment.End
            ) {
                // Nickname
                CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.medium) {
                    Text(chatMessage.username, fontSize = 13.sp)
                }

                // Message
                Card(
                    elevation = 2.dp
                ) {
                    SelectionContainer(Modifier.padding(8.dp)) {
                        SmartLinkText(text = chatMessage.message, maxLines = 10)
                    }
                }
            }

            // Profile Pic
            Box(
                modifier = Modifier
                    .size(45.dp)
                    .clip(CircleShape)
            ) {
                Image(
                    modifier = Modifier.fillMaxSize(),
                    painter = rememberImagePainter(chatMessage.avatar),
                    contentDescription = null
                )
            }
        }
Oh it's pushing the avatar off screen
r
yes
The measurement is still from left to right
t
You need to use the
weight
modifier on the flexible part of the layout
Otherwise it will measure up to the parent's maxWidth
r
ok,
weight
works
a
Please file a bug for this, seems worth a discussion at least 🙂
👍 1
opened