Last active
June 3, 2022 07:19
-
-
Save Mercandj/7e22c4e89b44fcc532c7c6724d808ceb to your computer and use it in GitHub Desktop.
Gist for this article https://medium.com/@jonathan.mercandalli_41381/tutorial-jetpack-compose-how-to-create-a-desktop-app-6e6e9392ac90
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.medium | |
import androidx.compose.foundation.layout.Box | |
import androidx.compose.foundation.layout.fillMaxHeight | |
import androidx.compose.foundation.layout.fillMaxWidth | |
import androidx.compose.material.Text | |
import androidx.compose.ui.Alignment | |
import androidx.compose.ui.Modifier | |
import androidx.compose.ui.unit.dp | |
import androidx.compose.ui.unit.sp | |
import androidx.compose.ui.window.Window | |
import androidx.compose.ui.window.WindowState | |
import androidx.compose.ui.window.application | |
fun main() = application { | |
Window( | |
onCloseRequest = ::exitApplication, | |
state = WindowState(width = 400.dp, height = 300.dp), | |
title = "Medium" | |
) { | |
Box(modifier = Modifier.fillMaxWidth().fillMaxHeight()) { | |
Text( | |
text = "Hello World", | |
fontSize = 30.sp, | |
modifier = Modifier.align(Alignment.Center) | |
) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment