kevin.cianfarini
12/03/2020, 1:17 AM<http://drawlayer.cc|drawlayer.cc>
that only references to X11 header files are made.Kirill Grouchnikov
12/03/2020, 3:10 AMkevin.cianfarini
12/03/2020, 5:57 PMron
12/03/2020, 8:11 PMKirill Grouchnikov
12/03/2020, 11:03 PMmelatonina
12/04/2020, 12:16 PMimport kotlinx.coroutines.*
import androidx.compose.desktop.*
import androidx.compose.material.*
import androidx.compose.runtime.*
fun main(args: Array<String>) = runBlocking {
val javaFxJob = GlobalScope.launch {
launch<HelloWorld>(args)
}
val composeDesktopJob = GlobalScope.launch {
Window {
var text by remember { mutableStateOf("Hello, World!") }
MaterialTheme {
Button(onClick = {
text = "Hello, Desktop!"
}) {
Text(text)
}
}
}
}
javaFxJob.join()
composeDesktopJob.join()
}
I'm getting crashes half of the time, unless I separate the startups of the two toolkits with a delay()
, so I guess there is something wrong. Otherwise it seems to work. This happens with both 0.3.0-build133 and 0.2.0-build132.Thomas
12/04/2020, 4:37 PMval colors = if (isSystemInDarkTheme()) {
darkColors()
} else {
lightColors()
}
Doesn't work because isSystemInDarkTheme() is not found. On the Android side it is currently resolved through foundation-1.0.0-alpha04. So, am I mistaken assuming Compose Desktop relies on another (earlier) version of androidx.compose.foundation? If I got something completely wrong, please forgive me, still apprenticing Compose Desktop. :-)spierce7
12/04/2020, 9:25 PMpy
12/04/2020, 11:35 PMprintln
?py
12/05/2020, 12:43 AMNikky
12/05/2020, 12:46 AMColton Idle
12/05/2020, 12:57 AMWindow
. the app builds... but I'm curious if anyone knows how to get rid of it?Kirill Grouchnikov
12/05/2020, 5:18 AMtoggle
button is using a multicolor icon from the Tango set, while flat
and always
buttons use the single-color icons from the Material set. The toggle
button is configured to use theme-provided colors and alpha for automatically filtering the icon appearance when the button is in the disabled state. You can see when content enabled
checkbox is unselected, the computer icon turns light brown when toggle
is selected (+disabled) and light gray when it's not selected (+disabled). The flat
and always
buttons are configured to have the icon always filtered to follow the text color. This "follow text" functionality can be seen in enabled/disabled states, as well as during the rollover when the icon and the text turn from black to dark brown.Luis Daivid
12/05/2020, 2:38 PMspierce7
12/05/2020, 9:09 PM/* = compiled code */
Dominaezzz
12/06/2020, 1:23 AMspierce7
12/06/2020, 5:55 AMdelay
, but I have a list of items potentially hundreds large, and it seems like there might be a better way that compose offers.galex
12/06/2020, 7:19 AMgbaldeck
12/07/2020, 12:23 AMspierce7
12/07/2020, 5:50 AMScrollableColumn
and got an error. I was annoyed that I had to refactor my screen because I had a LazyColumnFor
nested inside it.
• Using the item
syntax inside LazyColumn
was surprisingly delightful for building lazy content. I was pretty happy with how easy it made things.
• Not having access to ScrollBars in the common layer was pretty brutal.
• The current api for lazy column with scroll bars forces me to give an average item height and a count. This api was pretty cumbersome to use. This takes away most of the benefits from using the item
syntax with LazyColumn
.
• I’m going to avoid using `ScrollBar`s for now as I have to modify the way I’m developing too much, and the APIs are too error prone.orangy
12/07/2020, 7:43 AMUpdate(dt)
function frequently passing time passed since last call, which would update game mutable state and then I want UI to only touch things that actually depend on the change. I’ve searched the net and only found some clocks and Dino game, but they are just animating things directly, not doing this intermediate game state thing. Am I missing something? How I’d go with it?Thomas
12/07/2020, 12:48 PMcompose.desktop {
application {
mainClass = "com.thomaskuenneth.tkdupefinder.MainKt"
nativeDistributions {
targetFormats(TargetFormat.Dmg)
packageName = "TKDupeFinder"
version = "0.1-SNAPSHOT"
description = "Find duplicate files"
copyright = "© 2020 Thomas Kuenneth. All rights reserved."
vendor = "Thomas Kuenneth"
}
}
}
Colton Idle
12/08/2020, 3:42 PMWindow
is underlined as an error. gif available of what I'm doingseb
12/08/2020, 4:00 PMmutableState
doesn’t have a get()
and thus cannot be used as a delegate. Code copied from the official samples. Weirdest part is, it works with the code samples, same IDE, Kotlin version, CfD version. I suspect it may be some Kotlin compiler plugin in my build interfering — I already had to remove kotlinx.serialization as its compiler plugin would just crash with NPEs as soon as I added @Serializable
to literally any class. Maybe it’s coroutines? Will do some further testing, was mostly wondering whether there’s any known compat issuesThiago
12/09/2020, 12:36 AMsuresh
12/09/2020, 7:24 AMShow Kotlin Bytecode
still shows the compose annotation and not the transformed function with composer context as first argument.tieskedh
12/09/2020, 9:11 AMKris Elsinga
12/10/2020, 10:38 AMgradle :desktop:package
And I'm only getting a .deb
Even if I use
gradle :desktop:packageMsi
I don't get an .msi file
Does anyone know how to build an .msi with compose?
I work on a linux vmAli Albaali
12/10/2020, 10:33 PMpublic suspend fun main() {
getImage()
.fold(
onSuccess = { println("success") },
onFailure = { println("failure") }
)
Window {
LaunchedEffect(null) {
getImage()
.fold(
onSuccess = { println("success") },
onFailure = { println("failure") }
)
}
}
}
public suspend fun getImage(): Result<ByteReadChannel> = runCatching<ByteReadChannel> {
client.get<ByteReadChannel>("<https://i.redd.it/22bexa3ozc461.png>")
}
suresh
12/11/2020, 12:20 AMThread.UncaughtExceptionHandler
) and continue the recomposition or is this some kind of anti-pattern in compose?
Exception in thread "AWT-EventQueue-0 @coroutine#2" java.lang.IndexOutOfBoundsException: Index 5 out of bounds for length 5
at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:248)
at java.base/java.util.Objects.checkIndex(Objects.java:359)
at java.base/java.util.ArrayList.get(ArrayList.java:427)
at androidx.compose.material.TabRowKt$TabRow$1.invoke(TabRow.kt:117)
at androidx.compose.material.TabRowKt$TabRow$1.invoke(TabRow.kt)
suresh
12/11/2020, 12:20 AMThread.UncaughtExceptionHandler
) and continue the recomposition or is this some kind of anti-pattern in compose?
Exception in thread "AWT-EventQueue-0 @coroutine#2" java.lang.IndexOutOfBoundsException: Index 5 out of bounds for length 5
at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:248)
at java.base/java.util.Objects.checkIndex(Objects.java:359)
at java.base/java.util.ArrayList.get(ArrayList.java:427)
at androidx.compose.material.TabRowKt$TabRow$1.invoke(TabRow.kt:117)
at androidx.compose.material.TabRowKt$TabRow$1.invoke(TabRow.kt)
Timo Drick
12/11/2020, 3:31 AMjim
12/11/2020, 5:32 AMTimo Drick
12/11/2020, 8:29 AMsealed class LoadingState<out T: Any> {
object Start: LoadingState<Nothing>()
object Loading: LoadingState<Nothing>()
class Error(val error: Exception): LoadingState<Nothing>()
class Success<T: Any>(val data: T): LoadingState<T>()
}
@Composable
fun <T: Any> loadingStateFor(vararg inputs: Any?, initBlock: () -> LoadingState<T> = { LoadingState.Start },
loadingBlock: suspend CoroutineScope.() -> T): LoadingState<T> {
var state by remember(*inputs) { mutableStateOf(initBlock()) }
if (state !is LoadingState.Success) {
LaunchedEffect(*inputs) {
val loadingSpinnerDelay = async {
delay(500)
state = LoadingState.Loading
}
state = try {
LoadingState.Success(loadingBlock())
} catch (err: Exception) {
LoadingState.Error(err)
} finally {
loadingSpinnerDelay.cancelAndJoin()
}
}
}
return state
}
Than you can use it in your composables like that:
val imageState = loadingStateFor(image) {
loadImageSizeFileCached(image.file, width)
}
Box(Modifier.fillMaxSize()) {
InitializedCrossfade(imageState) { state ->
when (state) {
is LoadingState.Loading -> LoadingBox()
is LoadingState.Success -> Image(
modifier = Modifier.fillMaxSize(),
bitmap = state.data,
contentScale = ContentScale.Fit
)
is LoadingState.Error -> ErrorBox(
message = "Error: ${state.error.message}",
onRetry = { retryCounter++ })
}
}
}
suresh
12/11/2020, 6:56 PM