Nikolay Igotti
3 years ago
7 changed files with 27 additions and 31 deletions
@ -1,12 +1,11 @@
|
||||
package org.jetbrains.compose.demo.widgets.platform |
||||
|
||||
import androidx.compose.runtime.Composable |
||||
import androidx.compose.ui.graphics.ImageBitmap |
||||
import androidx.compose.ui.graphics.vector.ImageVector |
||||
import androidx.compose.ui.graphics.painter.Painter |
||||
|
||||
@Composable |
||||
expect fun imageResource(res: String): ImageBitmap |
||||
expect fun imageResource(res: String): Painter |
||||
|
||||
@Composable |
||||
expect fun vectorResource(res: String): ImageVector |
||||
expect fun vectorResource(res: String): Painter |
||||
|
||||
|
@ -1,14 +1,13 @@
|
||||
package org.jetbrains.compose.demo.widgets.platform |
||||
|
||||
import androidx.compose.runtime.Composable |
||||
import androidx.compose.ui.graphics.painter.Painter |
||||
import androidx.compose.ui.graphics.vector.ImageVector |
||||
import androidx.compose.ui.res.vectorXmlResource |
||||
import androidx.compose.ui.res.imageResource as bitmapImage |
||||
import androidx.compose.ui.res.loadXmlImageVector |
||||
import androidx.compose.ui.res.painterResource |
||||
|
||||
@Composable |
||||
actual fun imageResource(res: String) = |
||||
bitmapImage(res) |
||||
actual fun imageResource(res: String): Painter = painterResource(res) |
||||
|
||||
@Composable |
||||
actual fun vectorResource(res: String): ImageVector = |
||||
vectorXmlResource(res) |
||||
actual fun vectorResource(res: String): Painter = painterResource(res) |
@ -1,18 +1,13 @@
|
||||
package org.jetbrains.compose.demo.widgets |
||||
|
||||
import androidx.compose.ui.unit.DpSize |
||||
import androidx.compose.ui.unit.dp |
||||
import androidx.compose.ui.window.Window |
||||
import androidx.compose.ui.window.WindowSize |
||||
import androidx.compose.ui.window.WindowState |
||||
import androidx.compose.ui.window.application |
||||
import androidx.compose.ui.window.singleWindowApplication |
||||
import org.jetbrains.compose.demo.widgets.ui.MainView |
||||
|
||||
fun main() = application { |
||||
Window( |
||||
onCloseRequest = ::exitApplication, |
||||
title = "Widgets Gallery", |
||||
state = WindowState(size = WindowSize(800.dp, 600.dp)) |
||||
) { |
||||
MainView() |
||||
} |
||||
fun main() = singleWindowApplication( |
||||
title = "Widgets Gallery", state = WindowState(size = DpSize(800.dp, 800.dp)) |
||||
) { |
||||
MainView() |
||||
} |
Loading…
Reference in new issue