sealed class TimeTextScope


Receiver scope which is used by TimeText.

Summary

Protected constructors

Public functions

abstract Unit
composable(content: @Composable () -> Unit)

Adds a composable in content of TimeText.

abstract Unit

Adds a separator in TimeText.

abstract Unit
text(text: String, style: TextStyle?)

Adds a composable Text for non-round devices and curvedText for round devices to TimeText content.

abstract Unit

Adds a text displaying current time.

Protected constructors

TimeTextScope

protected TimeTextScope()

Public functions

composable

Added in 1.0.0-alpha21
abstract fun composable(content: @Composable () -> Unit): Unit

Adds a composable in content of TimeText. This can be used to display non-text information such as an icon.

An example of a TimeText with an icon along with the clock:

import androidx.compose.foundation.layout.size
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Favorite
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import androidx.wear.compose.material3.Icon
import androidx.wear.compose.material3.TimeText

TimeText {
    time()
    separator()
    composable {
        Icon(
            imageVector = Icons.Filled.Favorite,
            contentDescription = "Favorite",
            modifier = Modifier.size(13.dp)
        )
    }
}
Parameters
content: @Composable () -> Unit

Slot for the composable to be displayed.

separator

Added in 1.0.0-alpha21
abstract fun separator(style: TextStyle? = null): Unit

Adds a separator in TimeText.

Parameters
style: TextStyle? = null

configuration for the separator such as color, font etc.

text

Added in 1.0.0-alpha21
abstract fun text(text: String, style: TextStyle? = null): Unit

Adds a composable Text for non-round devices and curvedText for round devices to TimeText content.

Parameters
text: String

The text to display.

style: TextStyle? = null

configuration for the text such as color, font etc.

time

Added in 1.0.0-alpha21
abstract fun time(): Unit

Adds a text displaying current time.