Move content @Composable to the end of the parameter list.

A @Composable `content` parameter should be moved to be the trailing lambda in a composable function.
This commit is contained in:
Benoit Marty 2024-05-29 12:38:14 +02:00
parent 7eb7e21d27
commit e97e21e785
5 changed files with 25 additions and 22 deletions

View file

@ -54,8 +54,8 @@ fun FlowStepPage(
modifier: Modifier = Modifier,
onBackClick: (() -> Unit)? = null,
subTitle: String? = null,
content: @Composable () -> Unit = {},
buttons: @Composable ColumnScope.() -> Unit = {},
content: @Composable () -> Unit = {},
) {
BackHandler(enabled = onBackClick != null) {
onBackClick?.invoke()
@ -98,21 +98,20 @@ internal fun FlowStepPagePreview() = ElementPreview {
title = "Title",
subTitle = "Subtitle",
iconVector = CompoundIcons.Computer(),
content = {
Box(
Modifier
.fillMaxSize(),
contentAlignment = Alignment.Center
) {
Text(
text = "Content",
style = ElementTheme.typography.fontHeadingXlBold
)
}
},
buttons = {
TextButton(text = "A button", onClick = { })
Button(text = "Continue", onClick = { })
}
)
) {
Box(
Modifier
.fillMaxSize(),
contentAlignment = Alignment.Center
) {
Text(
text = "Content",
style = ElementTheme.typography.fontHeadingXlBold
)
}
}
}