mirror of
https://github.com/msfjarvis/compose-lobsters
synced 2025-08-14 16:27:06 +05:30
Initial commit
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
This commit is contained in:
commit
29c374859b
27 changed files with 823 additions and 0 deletions
46
common/build.gradle.kts
Normal file
46
common/build.gradle.kts
Normal file
|
@ -0,0 +1,46 @@
|
|||
import org.jetbrains.compose.compose
|
||||
|
||||
plugins {
|
||||
kotlin("multiplatform")
|
||||
id("org.jetbrains.compose") version "0.4.0"
|
||||
id("com.android.library")
|
||||
}
|
||||
|
||||
group = "dev.msfjarvis.claw"
|
||||
|
||||
version = "1.0"
|
||||
|
||||
repositories { google() }
|
||||
|
||||
kotlin {
|
||||
android()
|
||||
jvm("desktop") { compilations.all { kotlinOptions.jvmTarget = "11" } }
|
||||
sourceSets {
|
||||
val commonMain by getting {
|
||||
dependencies {
|
||||
api(compose.runtime)
|
||||
api(compose.foundation)
|
||||
api(compose.material)
|
||||
}
|
||||
}
|
||||
val commonTest by getting { dependencies { implementation(kotlin("test")) } }
|
||||
val androidMain by getting {
|
||||
dependencies {
|
||||
api("androidx.appcompat:appcompat:1.3.0")
|
||||
api("androidx.core:core-ktx:1.5.0")
|
||||
}
|
||||
}
|
||||
val androidTest by getting { dependencies { implementation("junit:junit:4.13.2") } }
|
||||
val desktopMain by getting
|
||||
val desktopTest by getting
|
||||
}
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdkVersion(30)
|
||||
sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
|
||||
defaultConfig {
|
||||
minSdkVersion(23)
|
||||
targetSdkVersion(30)
|
||||
}
|
||||
}
|
5
common/src/androidMain/AndroidManifest.xml
Normal file
5
common/src/androidMain/AndroidManifest.xml
Normal file
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<manifest
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="dev.msfjarvis.claw.common"
|
||||
/>
|
|
@ -0,0 +1,5 @@
|
|||
package dev.msfjarvis.claw.common
|
||||
|
||||
actual fun getPlatformName(): String {
|
||||
return "Android"
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package dev.msfjarvis.claw.common
|
||||
|
||||
import androidx.compose.material.Button
|
||||
import androidx.compose.material.MaterialTheme
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.setValue
|
||||
|
||||
@Composable
|
||||
fun App() {
|
||||
var text by remember { mutableStateOf("Hello, World!") }
|
||||
|
||||
MaterialTheme { Button(onClick = { text = "Hello, ${getPlatformName()}" }) { Text(text) } }
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
package dev.msfjarvis.claw.common
|
||||
|
||||
expect fun getPlatformName(): String
|
|
@ -0,0 +1,5 @@
|
|||
package dev.msfjarvis.claw.common
|
||||
|
||||
actual fun getPlatformName(): String {
|
||||
return "Desktop"
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue