All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.com.softartdev.theme.pref.DialogHolder.kt Maven / Gradle / Ivy

Go to download

Kotlin Multiplatform library for easy switching Dark/Light Material themes on Compose.

There is a newer version: 0.9.1
Show newest version
package com.softartdev.theme.pref

import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue

class DialogHolder {
    private var dialogContent: @Composable () -> Unit = {}
    private var showDialog: Boolean by mutableStateOf(false)

    fun showDialog(content: @Composable () -> Unit) {
        dialogContent = content
        showDialog = true
    }

    @Composable
    fun showDialogIfNeed() {
        if (showDialog) dialogContent()
    }

    fun dismissDialog() {
        showDialog = false
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy