Browse Source

Update README.md

pull/996/head
Igor Demin 3 years ago committed by GitHub
parent
commit
5207a59064
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      tutorials/Window_API_new/README.md

8
tutorials/Window_API_new/README.md

@ -251,7 +251,7 @@ private class MyWindowState(
## Function `singleWindowApplication` ## Function `singleWindowApplication`
There is a simplified function for creating a single window application: There is a simplified function for creating a single window application:
``` ```kotlin
import androidx.compose.ui.window.singleWindowApplication import androidx.compose.ui.window.singleWindowApplication
fun main() = singleWindowApplication { fun main() = singleWindowApplication {
@ -266,7 +266,7 @@ Use it if:
## Adaptive window size ## Adaptive window size
Sometimes we want to show some content as a whole without knowing in advance what exactly will be shown, meaning that we don’t know the optimal window dimensions for it. By setting one or both dimensions of your window’s WindowSize to Dp.Unspecified, Compose for Desktop will automatically adjust the initial size of your window in that dimension to accommodate its content: Sometimes we want to show some content as a whole without knowing in advance what exactly will be shown, meaning that we don’t know the optimal window dimensions for it. By setting one or both dimensions of your window’s WindowSize to Dp.Unspecified, Compose for Desktop will automatically adjust the initial size of your window in that dimension to accommodate its content:
``` ```kotlin
import androidx.compose.foundation.background import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Row
@ -558,7 +558,7 @@ private fun FileDialog(
## Draggable window area ## Draggable window area
If you window is undecorated and you want to add a custom draggable titlebar to it (or make the whole window draggable), you can use `DraggableWindowArea`: If you window is undecorated and you want to add a custom draggable titlebar to it (or make the whole window draggable), you can use `DraggableWindowArea`:
``` ```kotlin
import androidx.compose.foundation.background import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.fillMaxWidth
@ -580,7 +580,7 @@ fun main() = application {
} }
``` ```
Note that `WindowDraggableArea` can be used only inside `singleWindowApplication`, `Window` and `Dialog`. If you need to use it in another Composable function, pass `WindowScope` as a reciever there: Note that `WindowDraggableArea` can be used only inside `singleWindowApplication`, `Window` and `Dialog`. If you need to use it in another Composable function, pass `WindowScope` as a reciever there:
``` ```kotlin
import androidx.compose.foundation.background import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.fillMaxWidth

Loading…
Cancel
Save