Pablo
02/06/2024, 12:49 PMTextField(
modifier = modifier,
value = amountInput,
onValueChange = { amountInput = it },
singleLine = true,
label = (Text(stringResource(id = R.string.bill_amount))),
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Number)
)
The detected error is:
None of the following functions can be called with the arguments supplied.
TextField(TextFieldValue, (TextFieldValue) → Unit, Modifier = ..., Boolean = ..., Boolean = ..., TextStyle = ..., (() → Unit)? = ..., (() → Unit)? = ..., (() → Unit)? = ..., (() → Unit)? = ..., (() → Unit)? = ..., (() → Unit)? = ..., (() → Unit)? = ..., Boolean = ..., VisualTransformation = ..., KeyboardOptions = ..., KeyboardActions = ..., Boolean = ..., Int = ..., Int = ..., MutableInteractionSource = ..., Shape = ..., TextFieldColors = ...) defined in androidx.compose.material3
TextField(String, (String) → Unit, Modifier = ..., Boolean = ..., Boolean = ..., TextStyle = ..., (() → Unit)? = ..., (() → Unit)? = ..., (() → Unit)? = ..., (() → Unit)? = ..., (() → Unit)? = ..., (() → Unit)? = ..., (() → Unit)? = ..., Boolean = ..., VisualTransformation = ..., KeyboardOptions = ..., KeyboardActions = ..., Boolean = ..., Int = ..., Int = ..., MutableInteractionSource = ..., Shape = ..., TextFieldColors = ...) defined in androidx.compose.material3
The error is highlighting in red TextFieldValue
and (() → Unit)? = ...
in the error and Android studio is also highlighting in red a portion of the code non related with the error: it
from onValueChange
The real error here is simply that label = (Text(stringResource(id = R.string.bill_amount)))
must be between {}
instead of ()
. Why te error detection is not working correctly?ascii
02/06/2024, 1:04 PMlabel
must be a composable lambda, so of course it should be {}
. () does nothing.
it
can be known only if the full function matches, right? How else would the IDE know what onValueChange is supposed to be?
A single wrong parameter/syntax means nothing matches.Pablo
02/06/2024, 1:11 PM