https://kotlinlang.org logo
Docs
Join the conversationJoin Slack
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by Linen
compose-desktop
  • x

    xetra11

    11/25/2020, 2:10 PM
    Where can I find that one to use with Compose for Desktop
    z
    i
    +2
    • 5
    • 16
  • x

    xetra11

    11/25/2020, 2:31 PM
    Can sb. tell me the differenence between:
    Jetpack Compose
    vs
    JetBrains Compose Android/JVM/Multiplatform
    j
    a
    t
    • 4
    • 5
  • x

    xetra11

    11/25/2020, 3:55 PM
    Maybe I can find proper tutorials and guides now 😄
    s
    o
    • 3
    • 2
  • x

    xetra11

    11/25/2020, 3:56 PM
    Since I was searching for "jetpack compose" previously
    b
    • 2
    • 1
  • t

    Timo Drick

    11/25/2020, 5:57 PM
    I want to show thumbnails of images and cache compressed version of the thumbnails. My fastest approach yet uses Skia to load and scale the image. But to compress the image i have to use ImageIO.write because skia bindings do not support encoding of ImageAsset objects. Any ideas how to improve this?
    • 1
    • 1
  • x

    xetra11

    11/25/2020, 8:21 PM
    Asking for Google Keywords 😄 So in my app I have a table that is filled by a given
    List<String>
    . However I'd like to manipulate that state from another
    @Composable
    function (a popup dialog that opens). The values added in the popup should be added to the
    List<String>
    of the mentioned table so the content is updated there immediatly. I have a hard time grasping the concepts of state in Compose for Desktop. I am coming from a Vue.js background and I could not build the bridge regarding understanding the way to do that in Compose for Desktop. Therefore I'd like to ask for some keywords I should look out for on Google. I already tried a lib called
    Decompose
    but I do not fully understand it as it seems to only care about state within a component and not appwide (from my understanding)
    a
    • 2
    • 5
  • d

    Dominaezzz

    11/26/2020, 9:42 AM
    Is
    LazyColumnFor
    not supposed to have a scroll bar by default?
    o
    • 2
    • 2
  • m

    Martin Nowosad

    11/26/2020, 1:05 PM
    does anyone else find it confusing that the parameters like
    title
    are all lambdas in form of
    ()->Unit
    ?
    🇳🇴 15
    t
    d
    • 3
    • 2
  • a

    Adam Powell

    11/26/2020, 3:46 PM
    We've decided against typealiases for this sort of thing in the compose API. An aliased type name can tell you a bit about what the intended usage is, but then you still have to hold in your head/look up what the type actually is in order to provide one. In contrast, the function type clearly describes the type and the parameter name describes its purpose; you have everything you need to know at a glance even if it's an API you don't use often enough to commit to memory.
    b
    o
    +3
    • 6
    • 15
  • a

    Adam Powell

    11/26/2020, 3:47 PM
    For cases where the signature becomes too complex we're looking more at fun interfaces than typealiases
    s
    • 2
    • 1
  • t

    Timo Drick

    11/27/2020, 4:53 PM
    Experimented with Compose for Desktop the last weeks and implemented a Image Browser to show the potential for Compose: https://gitlab.com/compose1/imagebrowser Code is just prototype
    Screencast from 27.11.2020 17:47:39.webm
    🎉 14
    🔥 9
    👏 5
    😮 1
    o
    s
    s
    • 4
    • 11
  • n

    Nikky

    11/28/2020, 10:05 AM
    so i do not know much about compose.. but from what i can tell it will be a multiplatform library soon (as in available on android and desktop and possibly web), how well does it fit with
    expect
    /`actual` ? is there anyone who has built a android + desktop UI with this that shares components ?
    o
    • 2
    • 1
  • l

    Lazard

    11/28/2020, 4:36 PM
    Hello everyone ! I'm still trying to learn Jetpack Compose (Multiplatform in this case but I don't think it matters ?) and there is something I cannot seem to find online. Let's say I have a component (a Composable Function) with a state written like so :
    val (counter, setCounter) = remember { mutableStateOf(0) }
    If I want to create a
    incrementCounter()
    function to prevent writing
    setCounter(counter + 1)
    each time, inside my component I can write :
    fun incrementCounter(value = 1) { setCounter(counter + value) }
    But doing so, Jetpack Compose will behave weirdly and won't update the counter each time. If I instead declare it like that :
    val incrementCounter = fun(value: Int) { setCounter(counter + value) }
    It work without any problem ! The only problem is that I cannot use default values with this syntax. It reminds me of the arrow function in javascript and the reference of
    this
    . After a lot of trial and error, it seems the destructuration of the mutableState return is the culprit. Does anybody have an idea ? Is it possible to write an internal function in a Jetpack Compose component while still using destructuration ?
    t
    g
    • 3
    • 7
  • x

    xetra11

    11/28/2020, 8:36 PM
    What is the best practice to have for instance a "Load Textfile" option in the MenuBar but having the loaded file being displayed in a view? My problem is I have no idea how to share a mutableState between the MenuItem scope and the main view scope of the app
    t
    i
    • 3
    • 15
  • a

    Animesh Sahu

    11/29/2020, 10:15 AM
    is using
    java.awt.Toolkit.getDefaultToolkit().screenSize
    the correct way to obtain current screen dimensions? If yes, how'd ya obtain it in K/N in the future? Otherwise what's the correct way...
    i
    • 2
    • 3
  • t

    Tomoaki Iwasaki

    11/29/2020, 12:09 PM
    Hi. Now I'm trying improve coderViewer example in compose-jb repo. So I want to change VerticalSplittable to not stick out also right side(like left side). Any idea? I tried right panel's constraints.minwidth is to fixed value, but didn't work.
    i
    • 2
    • 2
  • a

    Animesh Sahu

    11/29/2020, 1:54 PM
    Window should have 20% of the space free on the right (60% consumed by the app, 20% by the offset), shouldn't it?
    i
    • 2
    • 2
  • x

    xetra11

    11/29/2020, 2:09 PM
    I have a question about @Composable requirements and compilation. Following an example from @Igor Demin I tried to setup mutable states before the
    Window()
    call. However it is not allowed due the following error:
    (24, 5): Functions which invoke @Composable functions must be marked with the @Composable annotation
    
    (25, 56): @Composable invocations can only happen from the context of a @Composable function
    
    (32, 35): @Composable invocations can only happen from the context of a @Composable function
    
    (33, 16): @Composable invocations can only happen from the context of a @Composable function
    This is the snippet:
    fun main() {
        val characterState: SnapshotStateList<Character> = remember {
            mutableStateListOf(
                CharacterTemplate.DEFAULT_CHARACTER,
                CharacterTemplate.DEFAULT_CHARACTER,
                CharacterTemplate.DEFAULT_CHARACTER
            )
        }
        val window = AppWindowAmbient.current!!.window
        val file = remember { mutableStateOf(File("")) }
    
        Window(
            title = "CK3 Mod Workbench",
            menuBar = MenuBar(
                Menu("File", MenuItem("Exit", onClick = { AppManager.exit() })),
                Menu(
                    "Characters",
                    MenuItem("Import characters", onClick = { }),
                    MenuItem("Dynasties", onClick = {})
                ),
            )
        ) {
            MaterialTheme(
                colors = workbenchLightColors(),
                shapes = workBenchShapes()
            ) {
                CharacterModuleView()
            }
        }
    }
    i
    • 2
    • 16
  • a

    Arkadii Ivanov

    11/29/2020, 3:07 PM
    There is an interesting situation. I'm working on a library that uses both Jetpack and JetBrains Compose. There are two separate modules for each Compose variant. JetBrains Compose releases are a bit ahead of Jetpack Compose. The latest JetBrains Compose version
    0.2.0-build132
    requires Kotlin 1.4.20, whereas Jetpack Compose
    1.0.0-alpha07
    requires Kotlin 1.4.10. Looks like I'm forced to use some older version of JetBrains Compose.
    j
    j
    a
    • 4
    • 19
  • a

    Animesh Sahu

    11/29/2020, 3:56 PM
    Just for fun: Is there a way to detect and react to key presses outside the focus (or when minimized).
    j
    s
    • 3
    • 6
  • k

    kevin

    11/29/2020, 9:44 PM
    Hi all, I’m trying to open the ‘compose-jb/examples/issues’ project in intelliJ Idea and I get this error: ‘This version of the Android Support plugin for IntelliJ IDEA (or Android Studio) cannot open this project, please retry with version 4.1 or newer.’ The project does open in Android Studio, but in AS I can’t change the Gradle settings (I’m getting SDK clashes that I think I can fix through the Gradle settings in Idea). I’m running Idea 2020.2.4 (and AS 1.4). I haven’t changed anything in the Gradle files (so I still have ‘classpath(“com.android.tools.build:gradle:4.1.1”)’ for example). Any ideas on how to fix this?
    • 1
    • 1
  • k

    kevin

    11/30/2020, 12:35 AM
    In the ‘examples/issues’ sample, if I add this line javaHome = “/usr/local/opt/openjdk” to the build.gradle.kts file and run the app I get the following error “Cannot open /usr/local/Cellar/openjdk/15.0.1/libexec/openjdk.jdk/Contents/Home/lib/libjawt.dylib: dlopen(/usr/local/Cellar/openjdk/15.0.1/libexec/openjdk.jdk/Contents/Home/lib/libjawt.dylib, 9): Library not loaded: @rpath/libjvm.dylib Referenced from: /usr/local/Cellar/openjdk/15.0.1/libexec/openjdk.jdk/Contents/Home/lib/libjawt.dylib Reason: image not found” I’ve just installed JDK15 I get the same error for JDK11 as well, this is on a mac with Open JDK installed with HomeBrew Any ideas? Thanks
    o
    • 2
    • 2
  • m

    Michael Paus

    11/30/2020, 2:00 PM
    I am just trying to get my head around compose-desktop. How would you create a time based, multi-platform animation of some complex graphics. The state of the graphics is computed based on the current time. So the graphics should be rendered constantly as fast as possible (capped to 60 fps). The examples that I have seen seem to use some Android features which are not available on desktop. The JavaFX equivalent of what I am looking for would be an AnimationTimer. Any help is appreciated.
    j
    s
    +2
    • 5
    • 7
  • l

    Lazard

    11/30/2020, 9:38 PM
    Hi everyone ! I'm trying to use Kotlin Redux to keep the state of my app global. The only problem is that I have a nullable value in my store and changing it does not recompose my application. Changing an object property recompose the component displaying it, but going from null to something does not 😕 I've logged before dispatching my action (right value), after dispatching it (state has changed) and in the component displaying it (no log). Forcing the recomposition by hiding the component and showing it again works, but I feel terrible doing this 😅 Does anybody have an idea ? Maybe shouldn't I use Kotlin Redux ?
    t
    • 2
    • 1
  • t

    Timo Drick

    12/01/2020, 1:06 AM
    I do see a huge drop in animation performance from build: 0.2.0-build129 to 0.2.0-build130. I do not know how to measure framerate in a CfD app yet but i see definitely many frame drops.
    j
    o
    d
    • 4
    • 5
  • t

    Thomas

    12/01/2020, 12:56 PM
    Could someone please hint on how to build a list that allows multiple selection of items? Here is what I have so far:
    @Composable
    fun ThirdRow(currentPos: Int, checksums: List<String>) {
        val items = if (checksums.isNotEmpty())
            df.getFiles(checksums[currentPos]) else emptyList()
        LazyColumnFor(items,
                modifier = Modifier.fillMaxSize().padding(8.dp),
                itemContent = { item ->
                    ListItem(text = { Text(item.parent) },
                            secondaryText = { Text(item.name) })
                })
    }
    j
    d
    • 3
    • 6
  • c

    ckloss

    12/01/2020, 9:11 PM
    Would anyone know how to make Dialog and AlertDialog adjust the size of the window according to the size of the content? And how to show the Dialog on the same monitor as the main window?
    i
    • 2
    • 4
  • h

    Hamza GATTAL

    12/01/2020, 11:02 PM
    Hi everyone Does anyone guide to a documentation or article about compose desktop components and utilities and everything important for a beginner
    a
    • 2
    • 2
  • s

    suresh

    12/02/2020, 7:29 PM
    Nice to see the support for creating uber jar
    ./gradlew packageUberJarForCurrentOS
    without any additional plugin (shadow)
    🎉 5
    s
    t
    • 3
    • 3
  • d

    Dominaezzz

    12/02/2020, 8:20 PM
    Can Kotlin 1.4.20 be used with the new milestone version?
    a
    • 2
    • 2
Powered by Linen
Title
d

Dominaezzz

12/02/2020, 8:20 PM
Can Kotlin 1.4.20 be used with the new milestone version?
a

Arkadii Ivanov

12/02/2020, 8:23 PM
I think it should be used)
d

Dominaezzz

12/02/2020, 8:24 PM
Ta
View count: 1