mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-08-12 09:13:23 +00:00
fix: keep reaction icons evenly distributed when Share is disabled
The reaction row gave every item except the last a `Modifier.weight()`, which made the last item collapse to its natural width and hug the right edge of the content area. With Share (icon-only) as the default last item, all icons appeared evenly distributed. When the user disabled Share, the last weighted slot moved to Zap. Zap renders icon + counter, so its natural-width row took more space at the right and pulled the rightmost icon away from where the other icons sat (each at the left of a now-wider weighted slice), leaving the row looking unbalanced. Give every reaction an equal weighted slice so icons sit at the left of their slice regardless of which reactions are enabled. The unused space at the end of the last slice naturally provides the right-side padding where Share used to sit.
This commit is contained in:
@@ -387,7 +387,6 @@ private fun GenericInnerReactionRow(
|
||||
renderReaction: @Composable (ReactionRowItem) -> Unit,
|
||||
) {
|
||||
val enabledReactions = remember(reactions) { reactions.filter { it.enabled } }
|
||||
val lastIndex = enabledReactions.lastIndex
|
||||
|
||||
Row(
|
||||
verticalAlignment = CenterVertically,
|
||||
@@ -403,14 +402,12 @@ private fun GenericInnerReactionRow(
|
||||
}
|
||||
}
|
||||
|
||||
enabledReactions.forEachIndexed { index, item ->
|
||||
val isLast = index == lastIndex
|
||||
enabledReactions.forEach { item ->
|
||||
val itemWeight = if (item.action == ReactionRowAction.Reply) weightTwo else 1f
|
||||
val mod = if (isLast) Modifier else Modifier.weight(itemWeight)
|
||||
Row(
|
||||
verticalAlignment = CenterVertically,
|
||||
horizontalArrangement = RowColSpacing,
|
||||
modifier = mod,
|
||||
modifier = Modifier.weight(itemWeight),
|
||||
) {
|
||||
renderReaction(item)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user