withStyle

Function

Common
inline fun <R : Any> Builder.withStyle(style: SpanStyle, block: Builder.() -> R): R

Pushes style to the AnnotatedString.Builder, executes block and then pops the style.

Parameters

styleSpanStyle to be applied
blockfunction to be executed

Returns

result of the block
Common
inline fun <R : Any> Builder.withStyle(
    style: ParagraphStyle,
    crossinline block: Builder.() -> R,
): R

Pushes style to the AnnotatedString.Builder, executes block and then pops the style.

Parameters

styleSpanStyle to be applied
blockfunction to be executed

Returns

result of the block