Function
Common
@ExperimentalFoundationStyleApi infix fun Style.then(other: Style): Style
Merges this styles with another. The style to the right on the then will overwrite the properties set by the style to the left.
Parameters
| other | the style to merge into the receiver. |
Common
fun InputTransformation.then(next: InputTransformation): InputTransformation
Creates a filter chain that will run next after this. Filters are applied sequentially, so any changes made by this filter will be visible to next.
The returned filter will use the KeyboardOptions from next if non-null, otherwise it will use the options from this transformation.
Parameters
| next | The InputTransformation that will be ran after this one. |
Code Examples
BasicTextFieldInputTransformationChainingSample
fun BasicTextFieldInputTransformationChainingSample() {
val removeFirstEFilter = InputTransformation {
val index = asCharSequence().indexOf('e')
if (index != -1) {
replace(index, index + 1, "")
}
}
val printECountFilter = InputTransformation {
println("found ${asCharSequence().count { it == 'e' }} 'e's in the string")
}
// Returns a filter that always prints 0 e's.
removeFirstEFilter.then(printECountFilter)
// Returns a filter that prints the number of e's before the first one is removed.
printECountFilter.then(removeFirstEFilter)
}