Skip to content

resize and opening new windows #252

Answered by arkivanov
tunglbarn asked this question in Q&A
Discussion options

You must be logged in to vote

Hello! This looks more like a Compose question. But I can share some ideas.

Scenario 01

I assume that you want to change the size of the window on an event from a component. You do something as follows:

class RootComponent constructor(
    componentContext: ComponentContext,
    private val onResizeWindow: (WindowSize) -> Unit,
) : Root, ComponentContext by componentContext {

    enum class WindowSize {
        NORMAL, LARGE
    }

    private fun makeLarge() {
        onResizeWindow(WindowSize.LARGE)
    }
}

// Main.kt
fun main() {
    val lifecycle = LifecycleRegistry()

    val windowState = WindowState()

    val root =
        RootComponent(
            componentContext = DefaultCo…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@tunglbarn
Comment options

@arkivanov
Comment options

@tunglbarn
Comment options

Answer selected by tunglbarn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants