Vaibhav Jaiswal
05/22/2024, 8:11 AMsupportingText = {
errors.organisation?.let(::errorText)
?: {
Text(
text = orgLabel,
style = MaterialTheme.typography.labelSmall,
fontStyle = FontStyle.Italic,
color = MaterialTheme.colorScheme.onSurfaceVariant.copy(alpha = 0.7f
)
}
},
on Text, MaterialTheme.typography and MaterialTheme.colorScheme
But this supporting text param is a Composable Lambda param
supportingText: (@Composable () -> Unit)? = null,
Android Studio also not showing it as an Error in the editoryoussef hachicha
05/22/2024, 8:19 AMVaibhav Jaiswal
05/22/2024, 8:20 AM?: { }
to ?: run { }
and it got fixedshikasd
05/22/2024, 11:21 AMeygraber
05/22/2024, 3:05 PM?: {{ }}
shikasd
05/22/2024, 3:55 PMshikasd
05/22/2024, 3:55 PMVaibhav Jaiswal
05/22/2024, 4:01 PMVaibhav Jaiswal
05/22/2024, 4:03 PMerrorText
composable is reused among multiple text fieldsshikasd
05/22/2024, 4:04 PMVaibhav Jaiswal
05/22/2024, 4:06 PMeygraber
05/22/2024, 4:15 PMsupportingText
lambda. So if errors.organization
is null, you're just creating the orgLabel
lambda, but never running it.
You probably want this (the same thing you posted but with the outer brackets removed)
supportingText = errors.organisation?.let(::errorText)
?: {
Text(
text = orgLabel,
style = MaterialTheme.typography.labelSmall,
fontStyle = FontStyle.Italic,
color = MaterialTheme.colorScheme.onSurfaceVariant.copy(alpha = 0.7f
)
}
Vaibhav Jaiswal
05/22/2024, 5:06 PMVaibhav Jaiswal
05/22/2024, 5:07 PM