Skip to content

Commit

Permalink
Update project
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelbel committed Nov 22, 2024
1 parent fe94350 commit caad037
Show file tree
Hide file tree
Showing 32 changed files with 70 additions and 766 deletions.
5 changes: 3 additions & 2 deletions composeApp/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
@file:OptIn(org.jetbrains.kotlin.gradle.ExperimentalWasmDsl::class)
@file:OptIn(ExperimentalWasmDsl::class, ExperimentalKotlinGradlePluginApi::class)

import org.apache.commons.io.output.ByteArrayOutputStream
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpackConfig
import java.nio.charset.Charset
Expand All @@ -26,7 +27,6 @@ private val gitCommitsCount: Int by lazy {

kotlin {
androidTarget {
@OptIn(ExperimentalKotlinGradlePluginApi::class)
compilerOptions {
jvmTarget.set(JvmTarget.JVM_11)
}
Expand Down Expand Up @@ -75,6 +75,7 @@ kotlin {
implementation(compose.foundation)
implementation(compose.material)
implementation(compose.material3)
implementation(compose.material3AdaptiveNavigationSuite)
implementation(compose.ui)
implementation(compose.components.resources)
implementation(compose.components.uiToolingPreview)
Expand Down
156 changes: 61 additions & 95 deletions composeApp/src/commonMain/kotlin/org/michaelbel/template/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ import androidx.compose.material.icons.outlined.Settings
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
import androidx.compose.material3.NavigationBarItem
import androidx.compose.material3.adaptive.navigationsuite.NavigationSuite
import androidx.compose.material3.adaptive.navigationsuite.NavigationSuiteScaffold
import androidx.compose.material3.darkColorScheme
import androidx.compose.material3.lightColorScheme
import androidx.compose.runtime.Composable
Expand Down Expand Up @@ -62,118 +64,82 @@ fun App() {
MaterialTheme(
colorScheme = if (isSystemInDarkTheme()) darkColorScheme() else lightColorScheme()
) {
Scaffold(
topBar = {
TopAppBar(
title = {
NavigationSuiteScaffold(
navigationSuiteItems = {
item(
selected = selectedRoute == Navigation.Home,
onClick = { selectedRoute = Navigation.Home },
icon = {
Icon(
imageVector = Icons.Outlined.Home,
contentDescription = null
)
},
label = {
Text(
text = TemplateName
text = "Home"
)
}
)
},
bottomBar = {
BottomAppBar {
NavigationBarItem(
selected = selectedRoute == Navigation.Home,
onClick = { selectedRoute = Navigation.Home },
icon = {
Icon(
imageVector = Icons.Outlined.Home,
contentDescription = null
)
},
label = {
Text(
text = "Home"
)
}
)

NavigationBarItem(
selected = selectedRoute == Navigation.Chat,
onClick = { selectedRoute = Navigation.Chat },
icon = {
BadgedBox(
badge = {
this@BottomAppBar.AnimatedVisibility(
visible = selectedRoute != Navigation.Chat,
enter = fadeIn(),
exit = fadeOut()
item(
selected = selectedRoute == Navigation.Chat,
onClick = { selectedRoute = Navigation.Chat },
icon = {
BadgedBox(
badge = {
AnimatedVisibility(
visible = selectedRoute != Navigation.Chat,
enter = fadeIn(),
exit = fadeOut()
) {
Box(
contentAlignment = Alignment.Center,
modifier = Modifier
.size(24.dp)
.background(color = Color.Red, shape = CircleShape)
) {
Box(
contentAlignment = Alignment.Center,
modifier = Modifier
.size(24.dp)
.background(color = Color.Red, shape = CircleShape)
) {
Text(
text = "12",
color = Color.White,
fontSize = 12.sp,
fontWeight = FontWeight.Medium
)
}
Text(
text = "12",
color = Color.White,
fontSize = 12.sp,
fontWeight = FontWeight.Medium
)
}
}
) {
Icon(
imageVector = Icons.Outlined.Email,
contentDescription = null
)
}
},
label = {
Text(
text = "Chat"
)
}
)

NavigationBarItem(
selected = selectedRoute == Navigation.Settings,
onClick = { selectedRoute = Navigation.Settings },
icon = {
) {
Icon(
imageVector = Icons.Outlined.Settings,
imageVector = Icons.Outlined.Email,
contentDescription = null
)
},
label = {
Text(
text = "Settings"
)
}
)
}
},
snackbarHost = {
SnackbarHost(
hostState = snackbarHostState
},
label = {
Text(
text = "Chat"
)
}
)
},
floatingActionButton = {
Button(
onClick = {
coroutineScope.launch {
snackbarHostState.showSnackbar(
message = "Single-line snackbar with action",
actionLabel = "Action"
)
}
item(
selected = selectedRoute == Navigation.Settings,
onClick = { selectedRoute = Navigation.Settings },
icon = {
Icon(
imageVector = Icons.Outlined.Settings,
contentDescription = null
)
},
label = {
Text(
text = "Settings"
)
}
) {
Icon(
imageVector = Icons.Outlined.Phone,
contentDescription = null
)
}
)
}
) { innerPadding ->
) {
NavHost(
navController = navHostController,
startDestination = selectedRoute,
modifier = Modifier.padding(innerPadding)
startDestination = selectedRoute
) {
composable<Navigation.Home> {
Box(
Expand Down
10 changes: 5 additions & 5 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ Kotlin Multiplatform Template

This is a Kotlin Multiplatform project targeting Android, iOS, Web, Desktop.

[![android](https://img.shields.io/badge/android-000000.svg?style=for-the-badge&logo=android&logoColor=white)](https://github.com/michaelbel/movies)
[![ios](https://img.shields.io/badge/ios-000000.svg?style=for-the-badge&logo=apple&logoColor=white)](https://github.com/michaelbel/movies)
[![jvm](https://img.shields.io/badge/jvm_desktop-000000.svg?style=for-the-badge&logo=pcgamingwiki&logoColor=white)](https://github.com/michaelbel/movies)
[![wasm](https://img.shields.io/badge/wasm-000000.svg?style=for-the-badge&logo=webassembly&logoColor=white)](https://github.com/michaelbel/mobiledevemoji)
[![js](https://img.shields.io/badge/javascript-000000.svg?style=for-the-badge&logo=javascript&logoColor=white)](https://github.com/michaelbel/mobiledevemoji)
[![android](https://img.shields.io/badge/android-000000.svg?style=for-the-badge&logo=android&logoColor=white)](https://github.com/michaelbel/kmp-template)
[![ios](https://img.shields.io/badge/ios-000000.svg?style=for-the-badge&logo=apple&logoColor=white)](https://github.com/michaelbel/kmp-template)
[![jvm](https://img.shields.io/badge/jvm_desktop-000000.svg?style=for-the-badge&logo=pcgamingwiki&logoColor=white)](https://github.com/michaelbel/kmp-template)
[![wasm](https://img.shields.io/badge/wasm-000000.svg?style=for-the-badge&logo=webassembly&logoColor=white)](https://github.com/michaelbel/kmp-template)
[![js](https://img.shields.io/badge/javascript-000000.svg?style=for-the-badge&logo=javascript&logoColor=white)](https://github.com/michaelbel/kmp-template)

## Screenshots

Expand Down
3 changes: 1 addition & 2 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,4 @@ dependencyResolutionManagement {
}
}

include(":composeApp")
include(":wearApp")
include(":composeApp")
67 changes: 0 additions & 67 deletions wearApp/build.gradle.kts

This file was deleted.

36 changes: 0 additions & 36 deletions wearApp/src/main/AndroidManifest.xml

This file was deleted.

This file was deleted.

10 changes: 0 additions & 10 deletions wearApp/src/main/java/org/michaelbel/template/WearApplication.kt

This file was deleted.

Loading

0 comments on commit caad037

Please sign in to comment.