![JAR search and dependency download from the Maven repository](/logo.png)
commonMain.com.softartdev.theme.pref.DialogHolder.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of theme-prefs-desktop Show documentation
Show all versions of theme-prefs-desktop Show documentation
Kotlin Multiplatform library for easy switching Dark/Light Material themes on Compose.
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