OpenOnPhoneDialogContent
Android
Component in Wear Material 3 Compose
This composable provides the content for an [OpenOnPhoneDialog] that displays an animated icon with curved text at the bottom.
Prefer using [OpenOnPhoneDialog] directly, which provides built-in animations when showing/hiding the dialog. This composable may be used to provide the content for an openOnPhone dialog if custom show/hide animations are required.
Last updated:
Installation
dependencies {
implementation("androidx.wear.compose:compose-material3:1.0.0-alpha34")
}
Overloads
@Composable
fun OpenOnPhoneDialogContent(
curvedText: (CurvedScope.() -> Unit)?,
durationMillis: Long,
modifier: Modifier = Modifier,
colors: OpenOnPhoneDialogColors = OpenOnPhoneDialogDefaults.colors(),
content: @Composable () -> Unit
): Unit
Parameters
name | description |
---|---|
curvedText | A slot for displaying curved text content which will be shown along the bottom edge of the dialog. We recommend using [openOnPhoneDialogCurvedText] for this parameter, which will give the default sweep angle and padding, and [OpenOnPhoneDialogDefaults.curvedTextStyle] as the style. |
durationMillis | The duration in milliseconds for which the progress indicator inside of this content is animated. This value should be previously adjusted by the accessibility manager according to the content displayed. See [OpenOnPhoneDialog] implementation for more details. |
modifier | Modifier to be applied to the openOnPhone content. |
colors | [OpenOnPhoneDialogColors] that will be used to resolve the colors used for this [OpenOnPhoneDialog]. |
content | A slot for displaying an icon inside the open on phone dialog, which can be animated. Defaults to [OpenOnPhoneDialogDefaults.Icon]. |
Code Example
OpenOnPhoneDialogSample
@Composable
fun OpenOnPhoneDialogSample() {
var showConfirmation by remember { mutableStateOf(false) }
// Use AppScaffold to improve OpenOnPhoneDialog's Performance
AppScaffold {
Box(Modifier.fillMaxSize()) {
FilledTonalButton(
modifier = Modifier.align(Alignment.Center),
onClick = { showConfirmation = true },
label = { Text("Open on phone") }
)
}
val text = OpenOnPhoneDialogDefaults.text
val style = OpenOnPhoneDialogDefaults.curvedTextStyle
OpenOnPhoneDialog(
visible = showConfirmation,
onDismissRequest = { showConfirmation = false },
curvedText = { openOnPhoneDialogCurvedText(text = text, style = style) }
)
}
}