Jan Skrasek
05/20/2022, 7:02 AMcontent
and having it as the last one, or
• make that slot rather named by its function and sort slots differently?
The second option seems more suitable, but only if there is another non slot argument as the last one, otherwise it would expose the last slot as trailing lambda, which is not good. What do you think?Stylianos Gakis
05/20/2022, 7:05 AMScaffold
and don’t steer away from that pattern. You can still name your “content” one differently I guess, but I’d still like it to be last.Stylianos Gakis
05/20/2022, 7:08 AMScaffold(
topBar = { TopAppBar() },
content = { FooScreen() }
) {
// this would be the parameter named `bottomBar` as the last one in line
BottomAppBar()
}
Would be super confusing in my opinion.Jan Skrasek
05/20/2022, 7:11 AMListChoice(
onClick = {},
icon = { Icon(Icons.Accommodation, contentDescription = null) },
description = { Text("Further description") },
trailingIcon = { Icon(Icons.ChevronRight, contentDescription = null) },
) {
Text("ListChoice title")
}
And we're thinking about if keep it this way with content, or name it title
and put it before icon parameter.Jan Skrasek
05/20/2022, 7:13 AMStylianos Gakis
05/20/2022, 7:13 AMListChoice
function signature looks like?Jan Skrasek
05/20/2022, 7:16 AM@Composable
public fun ListChoice(
onClick: () -> Unit,
modifier: Modifier = Modifier,
icon: @Composable () -> Unit = {},
description: @Composable () -> Unit = {},
trailingIcon: @Composable () -> Unit = {},
withSeparator: Boolean = true,
content: @Composable () -> Unit,
)
Stylianos Gakis
05/20/2022, 7:43 AMcontent
to text
or something similar as you said before, and still keep it as the last item without a default value. I think then the API will look nice and will be very predictable for all devs trying to use it.Jan Skrasek
05/20/2022, 7:52 AM