Thread
#compose
    a

    Alan Yin

    1 year ago
    Modifier in if not working, please see code below
    val modifier = Modifier
            .preferredWidth(292.dp)
            .preferredHeight(87.dp)
            .clickable(onClick = { selectedItem.value = item })
        if (item == selectedItem.value){
            Timber.i("on item selected ")
            modifier.background(brush = lightHighLightGradient)
        }
        Text(
            modifier = modifier,
            // .padding(start = 35.dp),
            text = stringResource(id = item),
            fontSize = 32.sp,
            textAlign = TextAlign.Center
        )
    f

    fmasa

    1 year ago
    Modifiers are immutable, so
    Modifier.background()
    returns new instance, so you either have to make modifier
    var
    and replace
    modifier.background(brush = lightHighLightGradient)
    by
    modifier = modifier.background(brush = lightHighLightGradient)
    , or restructure it in other way.
    a

    Alan Yin

    1 year ago
    Thank you so much!