Browse Source

Move templates to 1.0.0-alpha1-rc1

pull/966/head
Nikolay Igotti 3 years ago
parent
commit
eceb3b8797
  1. 3
      templates/desktop-template/build.gradle.kts
  2. 16
      templates/desktop-template/src/main/kotlin/main.kt
  3. 5
      templates/multiplatform-template/common/build.gradle.kts
  4. 9
      templates/multiplatform-template/common/src/desktopMain/kotlin/DesktopApp.kt

3
templates/desktop-template/build.gradle.kts

@ -10,12 +10,13 @@ plugins {
repositories { repositories {
mavenCentral() mavenCentral()
google()
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
google() google()
} }
dependencies { dependencies {
implementation(compose.desktop.currentOs) implementation(compose.desktop.macos_x64)
} }
compose.desktop { compose.desktop {

16
templates/desktop-template/src/main/kotlin/main.kt

@ -1,15 +1,14 @@
import androidx.compose.desktop.ui.tooling.preview.Preview
import androidx.compose.material.Text import androidx.compose.material.Text
import androidx.compose.material.Button import androidx.compose.material.Button
import androidx.compose.material.MaterialTheme import androidx.compose.material.MaterialTheme
import androidx.compose.runtime.getValue import androidx.compose.runtime.*
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.window.Window import androidx.compose.ui.window.Window
import androidx.compose.ui.window.application import androidx.compose.ui.window.application
fun main() = application { @Composable
Window(onCloseRequest = ::exitApplication) { @Preview
fun Screen() {
var text by remember { mutableStateOf("Hello, World!") } var text by remember { mutableStateOf("Hello, World!") }
MaterialTheme { MaterialTheme {
@ -20,4 +19,9 @@ fun main() = application {
} }
} }
} }
fun main() = application {
Window(onCloseRequest = ::exitApplication) {
Screen()
}
} }

5
templates/multiplatform-template/common/build.gradle.kts

@ -18,6 +18,11 @@ kotlin {
api(compose.material) api(compose.material)
} }
} }
named("desktopMain") {
dependencies {
implementation(compose.uiTooling)
}
}
named("androidMain") { named("androidMain") {
dependencies { dependencies {
api("androidx.appcompat:appcompat:1.3.0-beta01") api("androidx.appcompat:appcompat:1.3.0-beta01")

9
templates/multiplatform-template/common/src/desktopMain/kotlin/DesktopApp.kt

@ -1 +1,10 @@
import androidx.compose.runtime.Composable
import androidx.compose.desktop.ui.tooling.preview.Preview
actual fun getPlatformName(): String = "Desktop" actual fun getPlatformName(): String = "Desktop"
@Preview
@Composable
fun AppPreview() {
App()
}
Loading…
Cancel
Save