mirror of
https://github.com/jlengrand/compose-multiplatform.git
synced 2026-03-10 15:48:51 +00:00
Update README.md
This commit is contained in:
@@ -122,20 +122,6 @@ fun main() = application {
|
||||
```
|
||||

|
||||
|
||||
|
||||
There is a simplified function for creating a single window application:
|
||||
```
|
||||
import androidx.compose.ui.window.singleWindowApplication
|
||||
|
||||
fun main() = singleWindowApplication {
|
||||
// Content
|
||||
}
|
||||
```
|
||||
Use it if:
|
||||
- your application has only one window
|
||||
- you don't need custom closing logic
|
||||
- you don't need to change the window parameters after it is already created
|
||||
|
||||
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
|
||||
@@ -262,6 +248,20 @@ private class MyWindowState(
|
||||
```
|
||||

|
||||
|
||||
## Function `singleWindowApplication`
|
||||
There is a simplified function for creating a single window application:
|
||||
```
|
||||
import androidx.compose.ui.window.singleWindowApplication
|
||||
|
||||
fun main() = singleWindowApplication {
|
||||
// Content
|
||||
}
|
||||
```
|
||||
Use it if:
|
||||
- your application has only one window
|
||||
- you don't need custom closing logic
|
||||
- you don't need to change the window parameters after it is already created
|
||||
|
||||
## Changing the state (maximized, minimized, fullscreen, size, position) of the window.
|
||||
|
||||
Some states of the native window are moved into a separate API class, `WindowState`. You can change its properties in callbacks or observe it in Composable's.
|
||||
@@ -539,4 +539,4 @@ fun main() = singleWindowApplication(
|
||||
}
|
||||
}
|
||||
```
|
||||

|
||||

|
||||
|
||||
Reference in New Issue
Block a user