mirror of
https://github.com/msfjarvis/compose-lobsters
synced 2025-08-14 23:27:04 +05:30
common: remove laggy SubmitterAvatar composable
This commit is contained in:
parent
a4eaad639f
commit
5d93597228
1 changed files with 0 additions and 26 deletions
|
@ -13,7 +13,6 @@ import androidx.compose.foundation.layout.fillMaxWidth
|
|||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.requiredSize
|
||||
import androidx.compose.foundation.layout.width
|
||||
import androidx.compose.foundation.shape.CircleShape
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material.Icon
|
||||
import androidx.compose.material.IconButton
|
||||
|
@ -24,7 +23,6 @@ import androidx.compose.material.Text
|
|||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.google.accompanist.flowlayout.FlowRow
|
||||
|
@ -33,8 +31,6 @@ import dev.msfjarvis.claw.common.res.heartBorderIcon
|
|||
import dev.msfjarvis.claw.common.res.heartIcon
|
||||
import dev.msfjarvis.claw.common.theme.titleColor
|
||||
import dev.msfjarvis.claw.database.local.SavedPost
|
||||
import io.kamel.image.KamelImage
|
||||
import io.kamel.image.lazyImageResource
|
||||
|
||||
val TEST_POST =
|
||||
SavedPost(
|
||||
|
@ -88,8 +84,6 @@ fun LobstersItem(
|
|||
}
|
||||
SubmitterName(
|
||||
text = "Submitted by ${post.submitterName}",
|
||||
avatarUrl = post.submitterAvatarUrl,
|
||||
contentDescription = "Submitted by ${post.submitterName}",
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -111,44 +105,24 @@ fun PostTitle(
|
|||
@Composable
|
||||
fun SubmitterName(
|
||||
text: String,
|
||||
avatarUrl: String,
|
||||
contentDescription: String,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
Row(
|
||||
modifier = Modifier.then(modifier),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
) {
|
||||
SubmitterAvatar(
|
||||
avatarUrl = avatarUrl,
|
||||
contentDescription = contentDescription,
|
||||
)
|
||||
SubmitterNameText(
|
||||
text = text,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun SubmitterAvatar(
|
||||
avatarUrl: String,
|
||||
contentDescription: String,
|
||||
) {
|
||||
KamelImage(
|
||||
resource = lazyImageResource(avatarUrl),
|
||||
contentDescription = contentDescription,
|
||||
modifier = Modifier.requiredSize(24.dp).clip(CircleShape),
|
||||
crossfade = true,
|
||||
)
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun SubmitterNameText(
|
||||
text: String,
|
||||
) {
|
||||
Text(
|
||||
text = text,
|
||||
modifier = Modifier.padding(start = 4.dp),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue