Avoids null model errors that might be delaying some of the rendering.

This commit is contained in:
Vitor Pamplona 2023-08-02 13:29:44 -04:00
parent 6cbee81e72
commit 579465ac6c

View File

@ -1,5 +1,6 @@
package com.vitorpamplona.amethyst.ui.components package com.vitorpamplona.amethyst.ui.components
import androidx.compose.foundation.Image
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
@ -64,6 +65,7 @@ fun RobohashFallbackAsyncImage(
model = Robohash.imageRequest(context, robot) model = Robohash.imageRequest(context, robot)
) )
if (model != null) {
AsyncImage( AsyncImage(
model = model, model = model,
contentDescription = contentDescription, contentDescription = contentDescription,
@ -77,6 +79,16 @@ fun RobohashFallbackAsyncImage(
colorFilter = colorFilter, colorFilter = colorFilter,
filterQuality = filterQuality filterQuality = filterQuality
) )
} else {
Image(
painter = painter,
contentDescription = contentDescription,
modifier = modifier,
alignment = alignment,
contentScale = contentScale,
colorFilter = colorFilter
)
}
} }
@Composable @Composable