mirror of
https://github.com/msfjarvis/compose-lobsters
synced 2025-08-14 21:07: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.padding
|
||||||
import androidx.compose.foundation.layout.requiredSize
|
import androidx.compose.foundation.layout.requiredSize
|
||||||
import androidx.compose.foundation.layout.width
|
import androidx.compose.foundation.layout.width
|
||||||
import androidx.compose.foundation.shape.CircleShape
|
|
||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
import androidx.compose.material.Icon
|
import androidx.compose.material.Icon
|
||||||
import androidx.compose.material.IconButton
|
import androidx.compose.material.IconButton
|
||||||
|
@ -24,7 +23,6 @@ import androidx.compose.material.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.draw.clip
|
|
||||||
import androidx.compose.ui.text.font.FontWeight
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import com.google.accompanist.flowlayout.FlowRow
|
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.res.heartIcon
|
||||||
import dev.msfjarvis.claw.common.theme.titleColor
|
import dev.msfjarvis.claw.common.theme.titleColor
|
||||||
import dev.msfjarvis.claw.database.local.SavedPost
|
import dev.msfjarvis.claw.database.local.SavedPost
|
||||||
import io.kamel.image.KamelImage
|
|
||||||
import io.kamel.image.lazyImageResource
|
|
||||||
|
|
||||||
val TEST_POST =
|
val TEST_POST =
|
||||||
SavedPost(
|
SavedPost(
|
||||||
|
@ -88,8 +84,6 @@ fun LobstersItem(
|
||||||
}
|
}
|
||||||
SubmitterName(
|
SubmitterName(
|
||||||
text = "Submitted by ${post.submitterName}",
|
text = "Submitted by ${post.submitterName}",
|
||||||
avatarUrl = post.submitterAvatarUrl,
|
|
||||||
contentDescription = "Submitted by ${post.submitterName}",
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -111,44 +105,24 @@ fun PostTitle(
|
||||||
@Composable
|
@Composable
|
||||||
fun SubmitterName(
|
fun SubmitterName(
|
||||||
text: String,
|
text: String,
|
||||||
avatarUrl: String,
|
|
||||||
contentDescription: String,
|
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier.then(modifier),
|
modifier = Modifier.then(modifier),
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
) {
|
) {
|
||||||
SubmitterAvatar(
|
|
||||||
avatarUrl = avatarUrl,
|
|
||||||
contentDescription = contentDescription,
|
|
||||||
)
|
|
||||||
SubmitterNameText(
|
SubmitterNameText(
|
||||||
text = text,
|
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
|
@Composable
|
||||||
fun SubmitterNameText(
|
fun SubmitterNameText(
|
||||||
text: String,
|
text: String,
|
||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
text = text,
|
text = text,
|
||||||
modifier = Modifier.padding(start = 4.dp),
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue