Lucas Kivi
04/03/2024, 9:23 PMmodifier should be. Seems like there are two options:
1. Always at the end
2. Wherever it exists in the signature of the function
// signature
fun UiStuff(
mandatoryState: MandatoryState,
modifier: Modifier = Modifier,
optionalState: OptionalState = OptionalState.A,
content: @Composable () -> Unit = {},
) { ... }
// call-site option 1
UiStuff(
mandatoryState = MandatoryState.A,
optionalState = OptionalState.A,
modifier = modifier
.background(...)
.border(...)
.androidPixyDust(...),
) {
// Content
}
// call-site option 2
UiStuff(
mandatoryState = MandatoryState.A,
modifier = modifier
.background(...)
.border(...)
.androidPixyDust(...),
optionalState = OptionalState.A,
) {
// Content
}Lucas Kivi
04/03/2024, 9:23 PMStylianos Gakis
04/03/2024, 9:38 PMElement functions MUST accept a parameter of typeFocus on the. This parameter MUST be named “`modifier`” and MUST appear as the first optional parameter in the element function’s parameter list. Element functions MUST NOT accept multipleModifierparameters.Modifier
MUST appear as the first optional parameter part.Stylianos Gakis
04/03/2024, 9:39 PMLucas Kivi
04/03/2024, 9:40 PMLucas Kivi
04/03/2024, 9:41 PMStylianos Gakis
04/03/2024, 9:42 PMStylianos Gakis
04/03/2024, 9:43 PMcommon case means without optional parametersThey are optimizing the API to be called normally without named parameters in the “common” cases, which is with all the default parameters left as-is. So I suppose what you are saying here is true.
Lucas Kivi
04/03/2024, 9:44 PMLucas Kivi
04/03/2024, 9:44 PMStylianos Gakis
04/03/2024, 9:46 PMStylianos Gakis
04/03/2024, 9:47 PMZach Klippenstein (he/him) [MOD]
04/03/2024, 10:35 PM