Confirmation

Composable Component

Confirmation lays out the content for an opinionated confirmation screen that displays a message to the user for durationMillis. It has a slot for an icon or image (which could be animated).

Android
@Composable
public fun Confirmation(
    onTimeout: () -> Unit,
    modifier: Modifier = Modifier,
    icon: @Composable (ColumnScope.() -> Unit)? = null,
    scrollState: ScalingLazyListState = rememberScalingLazyListState(),
    durationMillis: Long = DialogDefaults.ShortDurationMillis,
    backgroundColor: Color = MaterialTheme.colors.background,
    contentColor: Color = contentColorFor(backgroundColor),
    iconColor: Color = contentColor,
    verticalArrangement: Arrangement.Vertical = DialogDefaults.ConfirmationVerticalArrangement,
    contentPadding: PaddingValues = DialogDefaults.ContentPadding,
    content: @Composable ColumnScope.() -> Unit,
)

Parameters

onTimeoutEvent invoked when the dialog has been shown for durationMillis.
modifierModifier to be applied to the dialog.
iconAn optional slot for displaying an icon or image.
scrollStateThe scroll state for the dialog so that the scroll position can be displayed e.g. by the PositionIndicator passed to Scaffold.
durationMillisThe number of milliseconds for which the dialog is displayed, must be positive. Suggested values are DialogDefaults.ShortDurationMillis, DialogDefaults.LongDurationMillis or DialogDefaults.IndefiniteDurationMillis.
backgroundColorColor representing the background color for this dialog.
contentColorColor representing the color for content.
iconColorIcon Color that defaults to the contentColor, unless specifically overridden.
verticalArrangementThe vertical arrangement of the dialog's children. This allows us to add spacing between items and specify the arrangement of the items when we have not enough of them to fill the whole minimum size.
contentPaddingThe padding to apply around the whole of the dialog's contents.
contentA slot for the dialog title, expected to be one line of text.
Android

Deprecated This overload is provided for backwards compatibility with Compose for Wear OS 1.1.A newer overload is available which uses ScalingLazyListState from wear.compose.foundation.lazy package

@Composable
public fun Confirmation(
    onTimeout: () -> Unit,
    modifier: Modifier = Modifier,
    icon: @Composable (ColumnScope.() -> Unit)? = null,
    scrollState: androidx.wear.compose.material.ScalingLazyListState =
        androidx.wear.compose.material.rememberScalingLazyListState(),
    durationMillis: Long = DialogDefaults.ShortDurationMillis,
    backgroundColor: Color = MaterialTheme.colors.background,
    contentColor: Color = contentColorFor(backgroundColor),
    iconColor: Color = contentColor,
    verticalArrangement: Arrangement.Vertical = DialogDefaults.ConfirmationVerticalArrangement,
    contentPadding: PaddingValues = DialogDefaults.ContentPadding,
    content: @Composable ColumnScope.() -> Unit,
)

Parameters

onTimeoutEvent invoked when the dialog has been shown for durationMillis.
modifierModifier to be applied to the dialog.
iconAn optional slot for displaying an icon or image.
scrollStateThe scroll state for the dialog so that the scroll position can be displayed e.g. by the PositionIndicator passed to Scaffold.
durationMillisThe number of milliseconds for which the dialog is displayed, must be positive. Suggested values are DialogDefaults.ShortDurationMillis, DialogDefaults.LongDurationMillis or DialogDefaults.IndefiniteDurationMillis.
backgroundColorColor representing the background color for this dialog.
contentColorColor representing the color for content.
iconColorIcon Color that defaults to the contentColor, unless specifically overridden.
verticalArrangementThe vertical arrangement of the dialog's children. This allows us to add spacing between items and specify the arrangement of the items when we have not enough of them to fill the whole minimum size.
contentPaddingThe padding to apply around the whole of the dialog's contents.
contentA slot for the dialog title, expected to be one line of text.