Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ComposeWorkflow sketch #1266

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft

ComposeWorkflow sketch #1266

wants to merge 3 commits into from

Conversation

rjrjr
Copy link
Contributor

@rjrjr rjrjr commented Feb 21, 2025

 val composeWorkflow = ComposeWorkflow<String> {
    var count by remember { mutableStateOf(0) }

    LaunchedEffect(Unit) {
      while (true) {
        delay(1_000)
        count++
      }
    }

    count.toString()
  }

  val composeWorkflow = ComposeWorkflow.asWorkflow()

  override fun render(
    renderProps: Unit,
    renderState: State,
    context: RenderContext
  ): BodyAndOverlaysScreen<*, *> {
    val count = context.renderChild(composeWorkflow)

    // The rendering that will be displayed in the "Body" layer. This is the root of our Workflow
    // and will always be displayed.
    val body = BodyScreen(
      sillyText = count,
data class BodyScreen(
  val sillyText: String,
  // ...
) : ComposeScreen {

  @Composable override fun Content() {
    BasicTextField(
      value = "Ta da: $sillyText",
      onValueChange = {},
      modifier = Modifier.fillMaxWidth()
    )

rjrjr and others added 2 commits February 21, 2025 21:43
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants