https://kotlinlang.org logo
#compose-web
Title
# compose-web
s

Slackbot

03/06/2024, 9:29 AM
This message was deleted.
m

mohamed rejeb

03/06/2024, 9:47 AM
ł

Łukasz Lendzion

03/06/2024, 10:03 AM
thanks
Zrzut ekranu 2024-03-6 o 12.18.00.png
hmm?
Copy code
@Composable
private fun SectionTile(
    focusRequester: FocusRequester,
    focusManager: FocusManager,
    navigateToProductDetails: () -> Unit,
    imageUrl: String,
) {
    var alpha = remember { mutableStateOf(0.3f) }

    IconButton(modifier = Modifier
        .width(200.dp)
        .height(120.dp)
        .clip(RoundedCornerShape(15.dp))
        .background(MaterialTheme.colorScheme.onSecondary.copy(alpha = alpha.value))
        .focusRequester(focusRequester)
        .setKeyEventListener(focusManager)
        .onFocusChanged {
            if(it.isFocused){
                alpha.value = 0.2f
            }else {
                alpha.value = 0.3f
            }
        },
        onClick = { navigateToProductDetails() }
    ){
        Text("Hi")

        var placeholder: MemoryCache.Key? = remember { null }

        AsyncImage(
            model = ImageRequest.Builder(LocalPlatformContext.current)
                .data(imageUrl)
                .build(),
            contentDescription = null,
            placeholder = ColorPainter(Color.Red),
            error = ColorPainter(Color.Red),
            onSuccess = { placeholder = it.result.memoryCacheKey },
            contentScale = ContentScale.Crop,
            modifier = Modifier.fillMaxSize()
        )
    }
}
coil3 -> 3.0.0-alpha04, compose -> 1.6.0, kotlin -> 1.9.22
@mohamed rejeb
okay nvm i used kamel instead
2 Views