Fix issue around modifier.

This commit is contained in:
Benoit Marty 2023-07-05 15:10:52 +02:00
parent e55ed2f10b
commit db32484416
2 changed files with 9 additions and 8 deletions

View file

@ -38,9 +38,12 @@ import io.element.android.libraries.designsystem.theme.components.Icon
* @param swipeProgress the progress of the swipe, between 0 and X. When swipeProgress >= 1 the swipe will be detected.
*/
@Composable
fun RowScope.ReplySwipeIndicator(swipeProgress: Float) {
fun RowScope.ReplySwipeIndicator(
swipeProgress: Float,
modifier: Modifier = Modifier,
) {
Icon(
modifier = Modifier
modifier = modifier
.align(Alignment.CenterVertically)
.padding(start = 36.dp * swipeProgress.coerceAtMost(1f))
.alpha(swipeProgress),

View file

@ -136,7 +136,6 @@ fun TimelineItemEventRow(
directions = setOf(DismissDirection.StartToEnd),
dismissContent = {
TimelineItemEventRowContent(
modifier = Modifier,
event = event,
isHighlighted = isHighlighted,
interactionSource = interactionSource,
@ -145,13 +144,12 @@ fun TimelineItemEventRow(
onTimestampClicked = onTimestampClicked,
inReplyToClicked = ::inReplyToClicked,
onUserDataClicked = ::onUserDataClicked,
onReactionClicked = ::onReactionClicked
onReactionClicked = ::onReactionClicked,
)
}
)
} else {
TimelineItemEventRowContent(
modifier = Modifier,
event = event,
isHighlighted = isHighlighted,
interactionSource = interactionSource,
@ -160,7 +158,7 @@ fun TimelineItemEventRow(
onTimestampClicked = onTimestampClicked,
inReplyToClicked = ::inReplyToClicked,
onUserDataClicked = ::onUserDataClicked,
onReactionClicked = ::onReactionClicked
onReactionClicked = ::onReactionClicked,
)
}
// This is assuming that we are in a ColumnScope, but this is OK, for both Preview and real usage.
@ -173,7 +171,6 @@ fun TimelineItemEventRow(
@Composable
private fun TimelineItemEventRowContent(
modifier: Modifier,
event: TimelineItem.Event,
isHighlighted: Boolean,
interactionSource: MutableInteractionSource,
@ -182,7 +179,8 @@ private fun TimelineItemEventRowContent(
onTimestampClicked: (TimelineItem.Event) -> Unit,
inReplyToClicked: () -> Unit,
onUserDataClicked: () -> Unit,
onReactionClicked: (emoji: String) -> Unit
onReactionClicked: (emoji: String) -> Unit,
modifier: Modifier = Modifier,
) {
// To avoid using negative offset, we display in this Box a column with:
// - Spacer to give room to the Sender information if they must be displayed;