Desktop Window (WIP)

This commit is contained in:
2024-06-17 05:21:50 +02:00
parent 6384a65cbb
commit e4f89afe94
3 changed files with 45 additions and 18 deletions

View File

@@ -8,9 +8,12 @@ import androidx.compose.material3.Text
import androidx.compose.runtime.*
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import domain.Animals
import domain.Item
import org.jetbrains.compose.resources.ExperimentalResourceApi
import org.jetbrains.compose.resources.painterResource
import org.jetbrains.compose.ui.tooling.preview.Preview
import ui.DrawItem
import yaep.composeapp.generated.resources.Res
import yaep.composeapp.generated.resources.compose_multiplatform
@@ -19,19 +22,16 @@ import yaep.composeapp.generated.resources.compose_multiplatform
@Composable
@Preview
fun App() {
MaterialTheme {
var showContent by remember { mutableStateOf(false) }
Column(Modifier.fillMaxWidth(), horizontalAlignment = Alignment.CenterHorizontally) {
Button(onClick = { showContent = !showContent }) {
Text("Click me!")
}
AnimatedVisibility(showContent) {
val greeting = remember { Greeting().greet() }
Column(Modifier.fillMaxWidth(), horizontalAlignment = Alignment.CenterHorizontally) {
Image(painterResource(Res.drawable.compose_multiplatform), null)
Text("Compose: $greeting")
}
}
}
}
val size = 6
val options = remember { Animals.items.shuffled().take(size) }
var selectedItem by remember { mutableStateOf<Item<Animals>?>(Item(options.random())) }
// var selectedItem by remember { mutableStateOf<Item<Animals>?>(null) }
// Selector(
// category = Animals,
// options = Animals.items.map { Item(it) },
// selectedItem = selectedItem,
// onSelectItem = { selectedItem = it }
// )
DrawItem(selectedItem!!)
}