File tree Expand file tree Collapse file tree
compose-android/src/main/java/com/streamliners/compose/android/comp Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11package com.streamliners.compose.android.comp
22
3+ import android.graphics.drawable.Drawable
34import androidx.compose.foundation.clickable
45import androidx.compose.foundation.shape.CircleShape
56import androidx.compose.runtime.Composable
@@ -16,12 +17,23 @@ fun AsyncImage(
1617 data : String ,
1718 contentScale : ContentScale = ContentScale .Fit ,
1819 circleCrop : Boolean = false,
20+ placeHolderResId : Int? = null,
21+ placeHolderDrawable : Drawable ? = null,
1922 onClick : (() -> Unit )? = null
2023) {
2124 AsyncImage (
2225 model = ImageRequest .Builder (LocalContext .current)
2326 .data(data)
2427 .crossfade(true )
28+ .run {
29+ if (placeHolderResId != null ) {
30+ placeholder(placeHolderResId)
31+ } else if (placeHolderDrawable != null ) {
32+ placeholder(placeHolderDrawable)
33+ } else {
34+ this
35+ }
36+ }
2537 .build(),
2638 contentDescription = " " ,
2739 contentScale = contentScale,
You can’t perform that action at this time.
0 commit comments