Browse Source

Merge pull request #88 from JetBrains/todo_fix

Regression in Todo example app after multiple Compose updates
pull/95/head
Igor Demin 4 years ago committed by GitHub
parent
commit
5c00195547
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      examples/todoapp/common/edit/src/commonMain/kotlin/example/todo/common/edit/ui/TodoEditUi.kt
  2. 2
      examples/todoapp/common/main/src/commonMain/kotlin/example/todo/common/main/ui/TodoMainUi.kt
  3. 17
      examples/todoapp/desktop/src/jvmMain/kotlin/example/todo/desktop/Main.kt

2
examples/todoapp/common/edit/src/commonMain/kotlin/example/todo/common/edit/ui/TodoEditUi.kt

@ -1,7 +1,6 @@
package example.todo.common.edit.ui package example.todo.common.edit.ui
import androidx.compose.foundation.Icon import androidx.compose.foundation.Icon
import androidx.compose.foundation.Text
import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.Spacer
@ -10,6 +9,7 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width import androidx.compose.foundation.layout.width
import androidx.compose.material.Checkbox import androidx.compose.material.Checkbox
import androidx.compose.material.IconButton import androidx.compose.material.IconButton
import androidx.compose.material.Text
import androidx.compose.material.TextField import androidx.compose.material.TextField
import androidx.compose.material.TopAppBar import androidx.compose.material.TopAppBar
import androidx.compose.material.icons.Icons import androidx.compose.material.icons.Icons

2
examples/todoapp/common/main/src/commonMain/kotlin/example/todo/common/main/ui/TodoMainUi.kt

@ -1,6 +1,5 @@
package example.todo.common.main.ui package example.todo.common.main.ui
import androidx.compose.foundation.Text
import androidx.compose.foundation.clickable import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column
@ -17,6 +16,7 @@ import androidx.compose.material.Divider
import androidx.compose.material.Icon import androidx.compose.material.Icon
import androidx.compose.material.IconButton import androidx.compose.material.IconButton
import androidx.compose.material.OutlinedTextField import androidx.compose.material.OutlinedTextField
import androidx.compose.material.Text
import androidx.compose.material.TopAppBar import androidx.compose.material.TopAppBar
import androidx.compose.material.icons.Icons import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Delete import androidx.compose.material.icons.filled.Delete

17
examples/todoapp/desktop/src/jvmMain/kotlin/example/todo/desktop/Main.kt

@ -1,6 +1,5 @@
package example.todo.desktop package example.todo.desktop
import androidx.compose.desktop.AppWindow
import androidx.compose.desktop.DesktopTheme import androidx.compose.desktop.DesktopTheme
import androidx.compose.desktop.Window import androidx.compose.desktop.Window
import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxSize
@ -24,17 +23,19 @@ fun main() {
val lifecycle = LifecycleRegistry() val lifecycle = LifecycleRegistry()
lifecycle.resume() lifecycle.resume()
val todoRoot = TodoRoot(
componentContext = DefaultComponentContext(lifecycle),
dependencies = object : TodoRoot.Dependencies {
override val storeFactory = DefaultStoreFactory
override val database = TodoDatabase(TodoDatabaseDriver())
}
)
Window("Todo") { Window("Todo") {
Surface(modifier = Modifier.fillMaxSize()) { Surface(modifier = Modifier.fillMaxSize()) {
MaterialTheme { MaterialTheme {
DesktopTheme { DesktopTheme {
TodoRoot( todoRoot()
componentContext = DefaultComponentContext(lifecycle),
dependencies = object : TodoRoot.Dependencies {
override val storeFactory = DefaultStoreFactory
override val database = TodoDatabase(TodoDatabaseDriver())
}
).invoke()
} }
} }
} }

Loading…
Cancel
Save