更新
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
package com.aiosman.riderpro.ui.composables
|
||||
|
||||
import android.content.Context
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.layout.ContentScale
|
||||
import coil.compose.AsyncImage
|
||||
import com.aiosman.riderpro.utils.Utils.getImageLoader
|
||||
|
||||
@Composable
|
||||
fun CustomAsyncImage(
|
||||
context: Context,
|
||||
imageUrl: String,
|
||||
contentDescription: String?,
|
||||
modifier: Modifier = Modifier,
|
||||
contentScale: ContentScale = ContentScale.Crop
|
||||
) {
|
||||
val imageLoader = getImageLoader(context)
|
||||
AsyncImage(
|
||||
model = imageUrl,
|
||||
contentDescription = contentDescription,
|
||||
modifier = modifier,
|
||||
contentScale = contentScale,
|
||||
imageLoader = imageLoader
|
||||
)
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.layout.ContentScale
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.unit.dp
|
||||
import coil.compose.AsyncImage
|
||||
import com.aiosman.riderpro.model.MomentEntity
|
||||
@@ -18,6 +19,7 @@ fun RelPostCard(
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
val image = momentEntity.images.firstOrNull()
|
||||
val context = LocalContext.current
|
||||
Column(
|
||||
modifier = modifier
|
||||
) {
|
||||
@@ -26,7 +28,8 @@ fun RelPostCard(
|
||||
modifier=Modifier.padding(horizontal = 16.dp, vertical = 8.dp)
|
||||
) {
|
||||
image?.let {
|
||||
AsyncImage(
|
||||
CustomAsyncImage(
|
||||
context,
|
||||
image,
|
||||
contentDescription = null,
|
||||
modifier = Modifier.size(100.dp),
|
||||
|
||||
Reference in New Issue
Block a user