Skip to content

Commit

Permalink
Avoiding the creation of modifiers.
Browse files Browse the repository at this point in the history
  • Loading branch information
vitorpamplona committed Dec 30, 2023
1 parent 53a320b commit 2355a95
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
Expand Down Expand Up @@ -55,6 +54,8 @@ import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
import com.vitorpamplona.amethyst.ui.theme.ChatBubbleMaxSizeModifier
import com.vitorpamplona.amethyst.ui.theme.ChatBubbleShapeMe
import com.vitorpamplona.amethyst.ui.theme.ChatBubbleShapeThem
import com.vitorpamplona.amethyst.ui.theme.ChatPaddingInnerQuoteModifier
import com.vitorpamplona.amethyst.ui.theme.ChatPaddingModifier
import com.vitorpamplona.amethyst.ui.theme.DoubleHorzSpacer
import com.vitorpamplona.amethyst.ui.theme.Font12SP
import com.vitorpamplona.amethyst.ui.theme.ReactionRowHeightChat
Expand Down Expand Up @@ -218,7 +219,7 @@ fun NormalChatNote(
nav: (String) -> Unit,
onWantsToReply: (Note) -> Unit
) {
val drawAuthorInfo by remember {
val drawAuthorInfo by remember(note) {
derivedStateOf {
val noteEvent = note.event
if (accountViewModel.isLoggedUser(note.author)) {
Expand Down Expand Up @@ -267,31 +268,14 @@ fun NormalChatNote(
}

Column() {
val modif = remember {
if (innerQuote) {
Modifier.padding(top = 10.dp, end = 5.dp)
} else {
Modifier
.fillMaxWidth(1f)
.padding(
start = 12.dp,
end = 12.dp,
top = 5.dp,
bottom = 5.dp
)
}
}

Row(
modifier = modif,
modifier = if (innerQuote) ChatPaddingInnerQuoteModifier else ChatPaddingModifier,
horizontalArrangement = alignment
) {
val availableBubbleSize = remember { mutableIntStateOf(0) }
var popupExpanded by remember { mutableStateOf(false) }

val modif2 = remember {
if (innerQuote) Modifier else ChatBubbleMaxSizeModifier
}
val modif2 = if (innerQuote) Modifier else ChatBubbleMaxSizeModifier

val clickableModifier = remember {
Modifier
Expand Down
10 changes: 10 additions & 0 deletions app/src/main/java/com/vitorpamplona/amethyst/ui/theme/Shape.kt
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,16 @@ val ZeroPadding = PaddingValues(0.dp)
val FeedPadding = PaddingValues(top = 10.dp, bottom = 10.dp)
val ButtonPadding = PaddingValues(vertical = 6.dp, horizontal = 16.dp)

val ChatPaddingInnerQuoteModifier = Modifier.padding(top = 10.dp, end = 5.dp)
val ChatPaddingModifier = Modifier
.fillMaxWidth(1f)
.padding(
start = 12.dp,
end = 12.dp,
top = 5.dp,
bottom = 5.dp
)

val profileContentHeaderModifier = Modifier.fillMaxWidth().padding(top = 70.dp, start = Size25dp, end = Size25dp)
val bannerModifier = Modifier.fillMaxWidth().height(120.dp)
val drawerSpacing = Modifier.padding(top = Size10dp, start = Size25dp, end = Size25dp)
Expand Down

0 comments on commit 2355a95

Please sign in to comment.