Browse Source

Switching notepad App to latest Compose build (#1283)

* Switching notepad App to latest Compose build

* Switching to latest Compose build and making UI more consistent
pull/1288/head
akurasov 3 years ago committed by GitHub
parent
commit
52253a2777
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      examples/notepad/build.gradle.kts
  2. 7
      examples/notepad/src/main/kotlin/NotepadApplication.kt
  3. 4
      examples/todoapp-lite/build.gradle.kts
  4. 14
      examples/todoapp-lite/common/src/commonMain/kotlin/example/todoapp/lite/common/EditDialog.kt

4
examples/notepad/build.gradle.kts

@ -3,9 +3,9 @@ import org.jetbrains.compose.desktop.application.dsl.TargetFormat
plugins { plugins {
// __KOTLIN_COMPOSE_VERSION__ // __KOTLIN_COMPOSE_VERSION__
kotlin("jvm") version "1.5.21" kotlin("jvm") version "1.5.31"
// __LATEST_COMPOSE_RELEASE_VERSION__ // __LATEST_COMPOSE_RELEASE_VERSION__
id("org.jetbrains.compose") version ("1.0.0-alpha1") id("org.jetbrains.compose") version ("1.0.0-alpha4-build411")
} }
repositories { repositories {

7
examples/notepad/src/main/kotlin/NotepadApplication.kt

@ -2,6 +2,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.key import androidx.compose.runtime.key
import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.window.ApplicationScope
import androidx.compose.ui.window.MenuScope import androidx.compose.ui.window.MenuScope
import androidx.compose.ui.window.Tray import androidx.compose.ui.window.Tray
import common.LocalAppResources import common.LocalAppResources
@ -9,7 +10,7 @@ import kotlinx.coroutines.launch
import window.NotepadWindow import window.NotepadWindow
@Composable @Composable
fun NotepadApplication(state: NotepadApplicationState) { fun ApplicationScope.NotepadApplication(state: NotepadApplicationState) {
if (state.settings.isTrayEnabled && state.windows.isNotEmpty()) { if (state.settings.isTrayEnabled && state.windows.isNotEmpty()) {
ApplicationTray(state) ApplicationTray(state)
} }
@ -23,11 +24,11 @@ fun NotepadApplication(state: NotepadApplicationState) {
@OptIn(ExperimentalComposeUiApi::class) @OptIn(ExperimentalComposeUiApi::class)
@Composable @Composable
private fun ApplicationTray(state: NotepadApplicationState) { private fun ApplicationScope.ApplicationTray(state: NotepadApplicationState) {
Tray( Tray(
LocalAppResources.current.icon, LocalAppResources.current.icon,
state = state.tray, state = state.tray,
hint = "Notepad", tooltip = "Notepad",
menu = { ApplicationMenu(state) } menu = { ApplicationMenu(state) }
) )
} }

4
examples/todoapp-lite/build.gradle.kts

@ -7,9 +7,9 @@ buildscript {
dependencies { dependencies {
// __LATEST_COMPOSE_RELEASE_VERSION__ // __LATEST_COMPOSE_RELEASE_VERSION__
classpath("org.jetbrains.compose:compose-gradle-plugin:1.0.0-alpha4-build331") classpath("org.jetbrains.compose:compose-gradle-plugin:1.0.0-alpha4-build411")
classpath("com.android.tools.build:gradle:4.1.0") classpath("com.android.tools.build:gradle:4.1.0")
classpath(kotlin("gradle-plugin", version = "1.5.30")) classpath(kotlin("gradle-plugin", version = "1.5.31"))
} }
} }

14
examples/todoapp-lite/common/src/commonMain/kotlin/example/todoapp/lite/common/EditDialog.kt

@ -1,18 +1,14 @@
package example.todoapp.lite.common package example.todoapp.lite.common
import androidx.compose.foundation.layout.Column import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.*
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.sizeIn
import androidx.compose.foundation.layout.width
import androidx.compose.material.Checkbox import androidx.compose.material.Checkbox
import androidx.compose.material.Text import androidx.compose.material.Text
import androidx.compose.material.TextField import androidx.compose.material.TextField
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
@Composable @Composable
@ -37,9 +33,7 @@ internal fun EditDialog(
Spacer(modifier = Modifier.height(8.dp)) Spacer(modifier = Modifier.height(8.dp))
Row { Row {
Text(text = "Completed") Text(text = "Completed", Modifier.padding(15.dp))
Spacer(modifier = Modifier.width(8.dp))
Checkbox( Checkbox(
checked = item.isDone, checked = item.isDone,

Loading…
Cancel
Save