Igor Demin
4 years ago
4 changed files with 32 additions and 4 deletions
@ -1,6 +1,20 @@ |
|||||||
import androidx.compose.desktop.Window |
import androidx.compose.desktop.Window |
||||||
import androidx.compose.foundation.Text |
import androidx.compose.foundation.Text |
||||||
|
import androidx.compose.material.Button |
||||||
|
import androidx.compose.material.MaterialTheme |
||||||
|
import androidx.compose.runtime.getValue |
||||||
|
import androidx.compose.runtime.mutableStateOf |
||||||
|
import androidx.compose.runtime.remember |
||||||
|
import androidx.compose.runtime.setValue |
||||||
|
|
||||||
fun main() = Window { |
fun main() = Window { |
||||||
Text("Hello, World!") |
var text by remember { mutableStateOf("Hello, World!") } |
||||||
|
|
||||||
|
MaterialTheme { |
||||||
|
Button(onClick = { |
||||||
|
text = "Hello, Desktop!" |
||||||
|
}) { |
||||||
|
Text(text) |
||||||
|
} |
||||||
|
} |
||||||
} |
} |
@ -0,0 +1 @@ |
|||||||
|
actual fun getPlatformName(): String = "Android" |
@ -1,7 +1,19 @@ |
|||||||
import androidx.compose.foundation.Text |
import androidx.compose.foundation.Text |
||||||
import androidx.compose.runtime.Composable |
import androidx.compose.material.Button |
||||||
|
import androidx.compose.material.MaterialTheme |
||||||
|
import androidx.compose.runtime.* |
||||||
|
|
||||||
@Composable |
@Composable |
||||||
fun App() { |
fun App() { |
||||||
Text("Hello, World!") |
var text by remember { mutableStateOf("Hello, World!") } |
||||||
|
|
||||||
|
MaterialTheme { |
||||||
|
Button(onClick = { |
||||||
|
text = "Hello, ${getPlatformName()}" |
||||||
|
}) { |
||||||
|
Text(text) |
||||||
|
} |
||||||
|
} |
||||||
} |
} |
||||||
|
|
||||||
|
expect fun getPlatformName(): String |
Loading…
Reference in new issue