Skip to content

//workflow/com.squareup.workflow1.ui.compose

Package com.squareup.workflow1.ui.compose

Types

Name Summary
ComposeScreen [androidJvm]
Content
@WorkflowUiExperimentalApi()

interface ComposeScreen : AndroidScreen<Nothing>
More info
Interface implemented by a rendering class to allow it to drive a composable UI via an appropriate ComposeScreenViewFactory implementation, by simply overriding the Content method.


ComposeScreenViewFactory [androidJvm]
Content
@WorkflowUiExperimentalApi()

abstract class ComposeScreenViewFactory<RenderingT : Screen> : ScreenViewFactory<RenderingT>
More info
A ScreenViewFactory that uses a Composable function to display the rendering.


CompositionRoot [androidJvm]
Content
typealias CompositionRoot = @Composable()(@Composable()content: () -> Unit) -> Unit
More info


A composable function that will be used to wrap the first (highest-level) composeScreenViewFactory view factory in a composition. This can be used to setup any composition locals that all composeScreenViewFactory factories need access to, such as UI themes.



This function will called once, to wrap the highest-levelcomposeScreenViewFactory in the tree. However, composition locals are propagated down to child composeScreenViewFactory compositions, so any locals provided here will be available in allcomposeScreenViewFactory compositions.




Functions

Name Summary
asMutableState [androidJvm]
Content
@Composable()

fun TextController.asMutableState(): MutableState<String>
More info
Exposes the textValue of a TextController as a remembered MutableState, suitable for use from @Composable functions.


ComposeScreen [androidJvm]
Content
@WorkflowUiExperimentalApi()

inline fun ComposeScreen(crossinline content: @Composable()(ViewEnvironment) -> Unit): ComposeScreen
More info
Convenience function for creating anonymous ComposeScreens since composable fun interfaces aren’t supported.


composeScreenViewFactory [androidJvm]
Content
@WorkflowUiExperimentalApi()

inline fun <RenderingT : Screen> composeScreenViewFactory(noinline content: @Composable()(RenderingT, environment: ViewEnvironment) -> Unit): ScreenViewFactory<RenderingT>
More info
Creates a ScreenViewFactory that uses a Composable function to display the rendering.


renderAsState [androidJvm]
Content
@Composable()

fun <PropsT, OutputT : Any, RenderingT> Workflow<PropsT, OutputT, RenderingT>.renderAsState(props: PropsT, interceptors: List = emptyList(), scope: CoroutineScope = rememberCoroutineScope(), onOutput: suspend (OutputT) -> Unit): State<RenderingT>
More info
Runs this Workflow as long as this composable is part of the composition, and returns a State object that will be updated whenever the runtime emits a new RenderingT.


withCompositionRoot [androidJvm]
Content
@WorkflowUiExperimentalApi()

fun ScreenViewFactoryFinder.withCompositionRoot(root: CompositionRoot): ScreenViewFactoryFinder
More info
Returns a ScreenViewFactoryFinder that ensures that any composeScreenViewFactory factories registered in this registry will be wrapped exactly once with a CompositionRoot wrapper.


[androidJvm]
Content
@WorkflowUiExperimentalApi()

fun ViewEnvironment.withCompositionRoot(root: CompositionRoot): ViewEnvironment
More info
Convenience function for applying a CompositionRoot to this ViewEnvironment‘s ScreenViewFactoryFinder.


WorkflowRendering [androidJvm]
Content
@WorkflowUiExperimentalApi()
@Composable()

fun WorkflowRendering(rendering: Screen, viewEnvironment: ViewEnvironment, modifier: Modifier = Modifier)
More info
Renders rendering into the composition using this ViewEnvironment‘s ScreenViewFactoryFinder to generate the view.