feat: remove check if placeholder null and put a default placeholder if its not passed.

pull/850/head
qamarelsafadi 1 year ago
parent f1a2993adc
commit e276212574

@ -26,9 +26,11 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.ColorFilter import androidx.compose.ui.graphics.ColorFilter
import androidx.compose.ui.graphics.painter.Painter import androidx.compose.ui.graphics.painter.Painter
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import coil.compose.AsyncImage import coil.compose.AsyncImage
import coil.compose.SubcomposeAsyncImage import coil.compose.SubcomposeAsyncImage
import com.google.samples.apps.nowinandroid.core.designsystem.R
import com.google.samples.apps.nowinandroid.core.designsystem.theme.LocalTintTheme import com.google.samples.apps.nowinandroid.core.designsystem.theme.LocalTintTheme
/** /**
@ -44,12 +46,10 @@ fun DynamicAsyncImage(
val iconTint = LocalTintTheme.current.iconTint val iconTint = LocalTintTheme.current.iconTint
SubcomposeAsyncImage( SubcomposeAsyncImage(
error = { error = {
if (placeholder != null) { Image(
Image( painter = placeholder ?: painterResource(R.drawable.ic_placeholder_default),
painter = placeholder, contentDescription = "placeholder image",
contentDescription = "placeholder image", )
)
}
}, },
model = imageUrl, model = imageUrl,
contentDescription = contentDescription, contentDescription = contentDescription,

Loading…
Cancel
Save