new: init kmp project

This commit is contained in:
2026-05-18 18:21:49 +02:00
commit af66fd04e5
63 changed files with 5080 additions and 0 deletions
@@ -0,0 +1,49 @@
package fr.ajaury.gwenedeg
import androidx.compose.animation.AnimatedVisibility
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.safeContentPadding
import androidx.compose.material3.Button
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.*
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import org.jetbrains.compose.resources.painterResource
import gwenedeg.shared.generated.resources.Res
import gwenedeg.shared.generated.resources.compose_multiplatform
@Composable
@Preview
fun App() {
MaterialTheme {
var showContent by remember { mutableStateOf(false) }
Column(
modifier = Modifier
.background(MaterialTheme.colorScheme.primaryContainer)
.safeContentPadding()
.fillMaxSize(),
horizontalAlignment = Alignment.CenterHorizontally,
) {
Button(onClick = { showContent = !showContent }) {
Text("Click me!")
}
AnimatedVisibility(showContent) {
val greeting = remember { Greeting().greet() }
Column(
modifier = Modifier.fillMaxWidth(),
horizontalAlignment = Alignment.CenterHorizontally,
) {
Image(painterResource(Res.drawable.compose_multiplatform), null)
Text("Compose: $greeting")
}
}
}
}
}
@@ -0,0 +1,9 @@
package fr.ajaury.gwenedeg
class Greeting {
private val platform = getPlatform()
fun greet(): String {
return sayHello(platform.name)
}
}
@@ -0,0 +1,4 @@
package fr.ajaury.gwenedeg
fun sayHello(to: String): String =
"Hello, $to!"
@@ -0,0 +1,7 @@
package fr.ajaury.gwenedeg
interface Platform {
val name: String
}
expect fun getPlatform(): Platform