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 c92e6eb2e3
commit 919849acc2
5 changed files with 25 additions and 22 deletions

View file

@ -64,7 +64,6 @@ fun LogoutView(
subTitle = subtitle(state), subTitle = subtitle(state),
iconVector = CompoundIcons.KeySolid(), iconVector = CompoundIcons.KeySolid(),
modifier = modifier, modifier = modifier,
content = { Content(state) },
buttons = { buttons = {
Buttons( Buttons(
state = state, state = state,
@ -74,7 +73,9 @@ fun LogoutView(
} }
) )
}, },
) ) {
Content(state)
}
LogoutActionDialog( LogoutActionDialog(
state.logoutAction, state.logoutAction,

View file

@ -53,9 +53,10 @@ fun SecureBackupDisableView(
title = stringResource(id = R.string.screen_key_backup_disable_title), title = stringResource(id = R.string.screen_key_backup_disable_title),
subTitle = stringResource(id = R.string.screen_key_backup_disable_description), subTitle = stringResource(id = R.string.screen_key_backup_disable_description),
iconVector = CompoundIcons.KeyOffSolid(), iconVector = CompoundIcons.KeyOffSolid(),
content = { Content(state = state) },
buttons = { Buttons(state = state) }, buttons = { Buttons(state = state) },
) ) {
Content(state = state)
}
AsyncActionView( AsyncActionView(
async = state.disableAction, async = state.disableAction,

View file

@ -58,9 +58,10 @@ fun SecureBackupEnterRecoveryKeyView(
iconVector = CompoundIcons.KeySolid(), iconVector = CompoundIcons.KeySolid(),
title = stringResource(id = R.string.screen_recovery_key_confirm_title), title = stringResource(id = R.string.screen_recovery_key_confirm_title),
subTitle = stringResource(id = R.string.screen_recovery_key_confirm_description), subTitle = stringResource(id = R.string.screen_recovery_key_confirm_description),
content = { Content(state = state) },
buttons = { Buttons(state = state, onCreateRecoveryKey = onCreateNewRecoveryKey) } buttons = { Buttons(state = state, onCreateRecoveryKey = onCreateNewRecoveryKey) }
) ) {
Content(state = state)
}
} }
@Composable @Composable

View file

@ -52,9 +52,10 @@ fun SecureBackupSetupView(
title = title(state), title = title(state),
subTitle = subtitle(state), subTitle = subtitle(state),
iconVector = CompoundIcons.KeySolid(), iconVector = CompoundIcons.KeySolid(),
content = { Content(state) },
buttons = { Buttons(state, onFinish = onSuccess) }, buttons = { Buttons(state, onFinish = onSuccess) },
) ) {
Content(state = state)
}
if (state.showSaveConfirmationDialog) { if (state.showSaveConfirmationDialog) {
ConfirmationDialog( ConfirmationDialog(

View file

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