diff --git a/tutorials/Window_API_new/README.md b/tutorials/Window_API_new/README.md index d5ea1d419d..83919d0d3e 100644 --- a/tutorials/Window_API_new/README.md +++ b/tutorials/Window_API_new/README.md @@ -46,6 +46,8 @@ fun main() = application { ``` Window properties +## Open and close windows (conditionally) + You can also close/open windows using a simple `if` statement. When the `Window` leaves the composition (`isPerformingTask` becomes `false`) – the native window automatically closes. @@ -122,6 +124,8 @@ fun main() = application { ``` Ask to close +## Hide the window into the tray + If you don't need to close the window and just need to hide it (for example to the tray), you can change the `windowState.isVisible` state: ```kotlin import androidx.compose.material.Text @@ -179,6 +183,8 @@ object TrayIcon : Painter() { ``` Hide instead of closing +## Open and close multiple windows + If an application has multiple windows, then it is better to put its state into a separate class and open/close window in response to `mutableStateListOf` changes (see [notepad example](https://github.com/JetBrains/compose-jb/tree/master/examples/notepad) for more complex use cases): ```kotlin import androidx.compose.runtime.Composable