Browse Source
Maybe it will fix #1160 Fix for refactored Paragraph.getHorizontalPosition (#115)pull/1467/head
Alexey Tsvetkov
3 years ago
committed by
GitHub
5 changed files with 50 additions and 14 deletions
@ -1,16 +1,38 @@ |
|||||||
import androidx.compose.material.Text |
|
||||||
import androidx.compose.material.Button |
|
||||||
import androidx.compose.runtime.* |
|
||||||
import androidx.compose.desktop.ui.tooling.preview.Preview |
import androidx.compose.desktop.ui.tooling.preview.Preview |
||||||
|
import androidx.compose.foundation.Image |
||||||
|
import androidx.compose.foundation.layout.* |
||||||
|
import androidx.compose.material.* |
||||||
|
import androidx.compose.runtime.* |
||||||
|
import androidx.compose.ui.Modifier |
||||||
|
import androidx.compose.ui.graphics.Color |
||||||
|
import androidx.compose.ui.res.painterResource |
||||||
|
import androidx.compose.ui.unit.dp |
||||||
|
import androidx.compose.ui.window.singleWindowApplication |
||||||
|
|
||||||
@Preview |
@Preview |
||||||
@Composable |
@Composable |
||||||
fun ExamplePreview() { |
fun ExamplePreview() { |
||||||
var text by remember { mutableStateOf("Hello, World!") } |
var text by remember { mutableStateOf("Hello, World!") } |
||||||
|
val buttonColors = ButtonDefaults.buttonColors( |
||||||
Button(onClick = { |
backgroundColor = Color.Blue, |
||||||
text = "Hello, Desktop!" |
contentColor = Color.White |
||||||
}) { |
) |
||||||
Text(text) |
Button( |
||||||
|
colors = buttonColors, |
||||||
|
modifier = Modifier.padding(5.dp), |
||||||
|
onClick = { text = "Hello, Desktop!" } |
||||||
|
) { |
||||||
|
Row { |
||||||
|
Image( |
||||||
|
painterResource("compose-logo-white.png"), |
||||||
|
"compose-logo", |
||||||
|
modifier = Modifier.height(32.dp).width(32.dp), |
||||||
|
) |
||||||
|
Text(text, modifier = Modifier.padding(top = 8.dp, start = 5.dp)) |
||||||
} |
} |
||||||
} |
} |
||||||
|
} |
||||||
|
|
||||||
|
fun main() = singleWindowApplication { |
||||||
|
ExamplePreview() |
||||||
|
} |
After Width: | Height: | Size: 11 KiB |
Loading…
Reference in new issue