mirror of
https://github.com/Aviortheking/Neo-Store.git
synced 2025-04-23 19:32:16 +00:00
Add Spacer for loading image state
This commit is contained in:
parent
000bd16256
commit
4a58459f5c
@ -2,14 +2,19 @@ package com.looker.droidify.ui.compose.components
|
||||
|
||||
import android.net.Uri
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.shape.CornerBasedShape
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.layout.ContentScale
|
||||
import coil.annotation.ExperimentalCoilApi
|
||||
import coil.compose.ImagePainter
|
||||
import coil.compose.rememberImagePainter
|
||||
import com.looker.droidify.R
|
||||
import com.looker.droidify.ui.compose.theme.LocalShapes
|
||||
@ -20,6 +25,7 @@ fun NetworkImage(
|
||||
modifier: Modifier = Modifier,
|
||||
data: Uri?,
|
||||
contentScale: ContentScale = ContentScale.Crop,
|
||||
backgroundColor: Color = MaterialTheme.colorScheme.surface,
|
||||
shape: CornerBasedShape = RoundedCornerShape(LocalShapes.current.medium)
|
||||
) {
|
||||
Box(modifier) {
|
||||
@ -36,5 +42,13 @@ fun NetworkImage(
|
||||
.matchParentSize()
|
||||
.clip(shape)
|
||||
)
|
||||
|
||||
if (painter.state is ImagePainter.State.Loading) {
|
||||
Spacer(
|
||||
modifier = Modifier
|
||||
.matchParentSize()
|
||||
.background(backgroundColor)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user