Nikolay Igotti
3 years ago
8 changed files with 36 additions and 36 deletions
@ -1,21 +0,0 @@ |
|||||||
package org.jetbrains.compose.app |
|
||||||
|
|
||||||
import androidx.compose.runtime.Composable |
|
||||||
|
|
||||||
interface ComposeAppScope |
|
||||||
|
|
||||||
@Composable |
|
||||||
expect fun ComposeAppScope.Frame(content: @Composable () -> Unit) |
|
||||||
|
|
||||||
// Complex multi-frame application |
|
||||||
fun composeApplication(name: String = "application", title: String = "Compose Application", content: @Composable ComposeAppScope.() -> Unit) { |
|
||||||
composeApplicationImpl(name, title, content) |
|
||||||
} |
|
||||||
|
|
||||||
// Simple single-frame application. |
|
||||||
fun composeApp(name: String = "application", content: @Composable () -> Unit) { |
|
||||||
composeAppImpl(name, content) |
|
||||||
} |
|
||||||
|
|
||||||
internal expect fun composeApplicationImpl(name: String, title: String, content: @Composable ComposeAppScope.() -> Unit) |
|
||||||
internal expect fun composeAppImpl(name: String, content: @Composable () -> Unit) |
|
@ -1,13 +1,13 @@ |
|||||||
package org.jetbrains.compose.app.demo |
package org.jetbrains.compose.kapp.demo |
||||||
|
|
||||||
import androidx.compose.foundation.layout.Column |
import androidx.compose.foundation.layout.Column |
||||||
import androidx.compose.material.Button |
import androidx.compose.material.Button |
||||||
import androidx.compose.material.Text |
import androidx.compose.material.Text |
||||||
import androidx.compose.runtime.* |
import androidx.compose.runtime.* |
||||||
|
|
||||||
import org.jetbrains.compose.app.* |
import org.jetbrains.compose.kapp.* |
||||||
|
|
||||||
fun main() = composeApplication( |
fun main() = kapp( |
||||||
title = "App demo" |
title = "App demo" |
||||||
) { |
) { |
||||||
var visible by remember { mutableStateOf(5) } |
var visible by remember { mutableStateOf(5) } |
@ -0,0 +1,21 @@ |
|||||||
|
package org.jetbrains.compose.kapp |
||||||
|
|
||||||
|
import androidx.compose.runtime.Composable |
||||||
|
|
||||||
|
interface KAppScope |
||||||
|
|
||||||
|
@Composable |
||||||
|
expect fun KAppScope.Frame(content: @Composable () -> Unit) |
||||||
|
|
||||||
|
// Complex multi-frame application |
||||||
|
fun kapp(name: String = "application", title: String = "Compose Application", content: @Composable KAppScope.() -> Unit) { |
||||||
|
kappImpl(name, title, content) |
||||||
|
} |
||||||
|
|
||||||
|
// Simple single-frame application. |
||||||
|
fun simpleKapp(name: String = "application", content: @Composable () -> Unit) { |
||||||
|
simpleKappImpl(name, content) |
||||||
|
} |
||||||
|
|
||||||
|
internal expect fun kappImpl(name: String, title: String, content: @Composable KAppScope.() -> Unit) |
||||||
|
internal expect fun simpleKappImpl(name: String, content: @Composable () -> Unit) |
Loading…
Reference in new issue