Tgo1014
01/06/2023, 12:54 PMclickable is not being applied anymore. What's the proper way to handle dynamic modifiers?
val localModifier = Modifier
.fillMaxWidth()
.height(IntrinsicSize.Max)
.apply {
if (!disableClick) {
this.clickable {
Timber.w("Music CLicked")
onMusicClick.invoke(music)
}
}
}
.padding(8.dp)Giang
01/06/2023, 12:59 PMclickable accepts a enable parameter. You can pass !disableClick thereTgo1014
01/06/2023, 1:01 PMefemoney
01/06/2023, 2:04 PMefemoney
01/06/2023, 2:05 PMclickable on a modifier creates a new instanceefemoney
01/06/2023, 2:06 PMenable are not equivalent at all.efemoney
01/06/2023, 2:08 PMapply to runGiang
01/06/2023, 2:09 PMIt is 100% a bug since callingAgree. Using let or run will workon a modifier creates a new instanceclickable
Also the previous code and the new one of settingSurely they aren’t the same, but I think that’s what Tiago tries to achieve judging from the name of the parameter disableClickare not equivalent. One always adds the clickable modifier and disables it while the other does not add the clickable at allenable
efemoney
01/06/2023, 2:11 PMModifier.composed { ... } which has some very slight performance impact (cant remember the details)efemoney
01/06/2023, 2:12 PMmyanmarking
01/06/2023, 5:26 PM