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
  • k

    Konyaco

    03/21/2021, 2:33 AM
    Compose Desktop does not seem to support the ClearType on Windows?
    j
    1 reply · 2 participants
  • t

    theapache64

    03/21/2021, 7:43 AM
    Q: How can I draw text on a
    Canvas
    ? Can anyone show me some sample code?
    j
    n
    +2
    16 replies · 5 participants
  • a

    Arkadii Ivanov

    03/21/2021, 12:19 PM
    Are there any updates on plans to unify publications for MPP and Android-only Compose? When writing libraries for Compose I have to have separate modules for MPP and Android-only Compose variants, and copy-paste all the code. Or maybe I'm missing something?
    o
    a
    3 replies · 3 participants
  • d

    Danish Ansari

    03/21/2021, 2:25 PM
    I have created simple
    Row
    with some
    Text
    and
    IconButton
    but
    IconButton
    is going outside the
    Row
    , no idea why?
    Row(
        modifier = Modifier.fillMaxWidth().border(1.dp, Color.Red).padding(8.dp),
        horizontalArrangement = Arrangement.SpaceBetween,
        verticalAlignment = <http://Alignment.Top|Alignment.Top>,
    ) {
        VeryBigText(modifier = Modifier.border(1.dp, Color.Yellow))
        IconButton(   onClick = {}, modifier = Modifier.requiredSize(24.dp).border(1.dp, Color.Green)) {
            Icon(
                Icons.Default.Close,
                contentDescription = "Dismiss",
                modifier = Modifier.requiredSize(16.dp)
            )
        }
    }
    What am I doing wrong?
    :thank-you: 1
    :thread-please: 1
    d
    d
    +1
    5 replies · 4 participants
  • y

    Yan Pujante

    03/21/2021, 3:11 PM
    Let's say I have the following code:
    Row(Modifier.background(color = MaterialTheme.colors.primary)) {
                Text(
                    tabSelected.toString(),
                    color = MaterialTheme.colors.onPrimary,
                    style = MaterialTheme.typography.h6,
                    modifier = Modifier.padding(10.dp).weight(1f)
                )
        }
    How can I get the size (width and height) of the row after it is rendered?
    z
    2 replies · 2 participants
  • o

    orangy

    03/21/2021, 5:45 PM
    Left button is how Figma draws it, right button is screenshot from DC app. There are two issues here. First is sizing, the distance between guide lines is exactly 64 (Figma size units), and you can see that center of the border goes exactly along guides, while DC app has slightly bigger size (the size of the button is 32.dp, so at Retina resolution it should be same 64px). Second problem is quality of the rounding corners rendering. You can clearly see (especially if you zoom it), that they appear thicker than straight line, and anti-aliasing is somewhat of mediocre quality.
    r
    j
    +3
    56 replies · 6 participants
  • e

    Eric Chee

    03/21/2021, 9:14 PM
    Hello, I was wondering if there was a way to set a custom Cursor icon. (i.e. Pointer, Hand, Crosshair, etc.) Want to put a hand cursor when I hover over an actionable item
    o
    i
    2 replies · 3 participants
  • g

    gbaldeck

    03/21/2021, 10:26 PM
    I have a Gradle task that depends on the
    packageMsi
    task.
    packageMsi
    works fine when run by itself, but when I run my task that depends on it
    packageMsi
    fails with
    A problem was found with the configuration of task ':packageMsi' (type 'AbstractJPackageTask').
    File 'C:\my_workspace\grim-locations\build\compose\default-icons\0.4.0-build173\icon-windows.ico' specified for property 'iconFile' does not exist.
    Has anyone else experienced this?
    j
    o
    +1
    5 replies · 4 participants
  • o

    Olivier Patry

    03/21/2021, 10:56 PM
    I use
    DisposableEffect
    to cleanup some resources hosted by a state object. When I close the window using the system close button, my
    onDispose {}
    isn't called (but `Window`'s
    onDismissRequest {}
    is). Is it expected? I feel it buggy, I would expect composable being disposed explicitly, no?
    j
    i
    6 replies · 3 participants
  • z

    zhuinden

    03/22/2021, 7:49 AM
    Does anyone directly reuse Compose code between Android and Desktop, or do most people write this code separately (one platform only)?
    j
    i
    +1
    3 replies · 4 participants
  • t

    theapache64

    03/22/2021, 8:27 AM
    🎉 I've created a kinetic clock using Compose Desktop's Canvas API! :compose: :magic_wand: GitHub : https://github.com/theapache64/klokk
    klokk.mp4
    ✌️ 2
    🔥 26
    👍 11
    d
    j
    4 replies · 3 participants
  • y

    Yan Pujante

    03/22/2021, 2:54 PM
    In Android Studio (Artic Fox / Canary) there is a 'Preferences/Editor/Color Scheme/Compose' section (which simply allow to specify the look and feel of
    @Composable
    calls). I am not seeing it in IntelliJ Utlimate 2020.3.3. Is there a way to add such an entry?
    j
    c
    11 replies · 3 participants
  • s

    Sergey Y.

    03/22/2021, 3:19 PM
    1647103: Compile Compose on K/Native | https://android-review.googlesource.com/c/platform/frameworks/support/+/1647103
    👀 7
    :party-parrot: 3
    :kotlin-intensifies: 13
    s
    g
    +4
    11 replies · 7 participants
  • o

    Olivier Patry

    03/22/2021, 5:10 PM
    message has been deleted
    t
    3 replies · 2 participants
  • o

    Olivier Patry

    03/22/2021, 10:28 PM
    I have difficulties with
    DropdownMenu
    positioning.
    x
    coordinate of the menu is correct but the vertical position is wrong always stick to the bottom of the window. It seems close to https://github.com/JetBrains/compose-jb/issues/195 which is closed though. And the mechanic wasn't the same as of now it seems. You can see in the :thread-please: the details (code & screenshots)
    c
    8 replies · 2 participants
  • t

    TheMrCodes

    03/22/2021, 10:31 PM
    Could we use
    LocalSaveableStateRegistry
    to store Scrolle state and simular values across the whole application? And if thats the case can anyone describe how it's API is intendet to be used / whats its lifecycle is? Findings in the 🧵
    2 replies · 1 participant
  • c

    Chris Sinco [G]

    03/23/2021, 2:25 AM
    Is the
    svgResource
    function expected to work in the context of a Compose Desktop app running in an IntelliJ plugin? I tried adding a simple SVG into the
    resources
    directory, using the IDEA plugin example, then referenced it in an
    Icon
    . I get this error now from
    openResourceStream
    java.lang.IllegalArgumentException: Resource circle.svg not found
    	at androidx.compose.ui.res.Resources_desktopKt.openResourceStream(Resources.desktop.kt:23)
    	at androidx.compose.ui.res.DesktopSvgResources_desktopKt.svgResource(DesktopSvgResources.desktop.kt:48)
    	at com.jetbrains.compose.ComposableSingletons$ComposeDemoActionKt$lambda-1$1.invoke(ComposeDemoAction.kt:60)
    	at com.jetbrains.compose.ComposableSingletons$ComposeDemoActionKt$lambda-1$1.invoke(ComposeDemoAction.kt:54)
    o
    i
    +1
    24 replies · 4 participants
  • m

    Michał Kalinowski

    03/23/2021, 8:34 AM
    What plans are about swing, will it be a fundamental of compose like now, or will it be discarded and replaced in the distant future?
    d
    3 replies · 2 participants
  • s

    sonder-joker

    03/23/2021, 10:06 AM
    I wish to make a loading animation windows during loading, and exit on application launch success, but when I
    AppManager.focusedWindow?.close()
    the loading animation windowss, it will entirely exit What's the best way to solve it?
    o
    2 replies · 2 participants
  • d

    Dan Peluso

    03/23/2021, 6:07 PM
    I am not able to get the
    compose-jb/templates/multiplatform-jb
    to build on my machine. I have the project SDK set to Java 11, but every time I sync my
    build.gradle.kts
    , the build shows me errors on the (common) and (android) build.gradle.kts. It looks like something is wrong with how I'm importing the SDK, or maybe I have a project structure field wrong. Does this look familiar to anybody else? Cloned the most up-to-date repo and for the life of me I cannot get it to build (with zero code changes) errors in thread
    o
    j
    +2
    45 replies · 5 participants
  • y

    Yan Pujante

    03/23/2021, 7:00 PM
    how to I provide argument lines to the run target? I would like to enable assertions (
    -ea
    ).
    s
    a
    3 replies · 3 participants
  • s

    Shalaga44

    03/24/2021, 5:00 AM
    Hi I'm trying to create this background, do you know how I create a surface for each part my code:
    Surface(modifier = Modifier.fillMaxSize()) {
        Box {
            Canvas(Modifier.fillMaxSize()) {
                val midWidth = size.width / 2
                val midSpace = 200f * density
                val leftPoint = midWidth - (midSpace / 2)
                val rightPoint = midWidth + (midSpace / 2)
                val leftPath = Path().apply {
                    moveTo(size.width, 0f)
                    lineTo(rightPoint, 0f)
                    lineTo(leftPoint, size.height)
                    lineTo(size.width, size.height)
                    close()
                }
                val rightPath = Path().apply {
                    moveTo(0f, 0f)
                    lineTo(rightPoint, 0f)
                    lineTo(leftPoint, size.height)
                    lineTo(0f, size.height)
                    close()
                }
                drawPath(leftPath, Color.Red)
                drawPath(rightPath, Color.Black)
            }
            val text = "ABILITY TO"
            Text(
                text = text,
                textAlign = TextAlign.Center,
                modifier = Modifier.align(Alignment.Center),
                style = MaterialTheme.typography.h1,
                fontWeight = FontWeight.Bold,
                color = Color.Black
            )
    
            Text(
                text = text,
                textAlign = TextAlign.Center,
                modifier = Modifier.align(Alignment.Center),
                style = MaterialTheme.typography.h1,
                fontWeight = FontWeight.Bold,
                color = Color.Red,
    
            )
        }
    }
    preview.jpg (6)
    😯 2
    o
    n
    +2
    12 replies · 5 participants
  • r

    romainbsl

    03/25/2021, 11:23 AM
    Hi everyone! We are looking at providing a DI module for (Jetpack/JetBrains) Compose with #kodein. My question is simple: Does JetBrains Compose releases are following the Kotlin ones ? Or the latency is as large as I should consider not including it in our main builds to avoid blocker ?
    o
    j
    3 replies · 3 participants
  • r

    romainbsl

    03/25/2021, 2:51 PM
    I also have a question regarding the use of Desktop Compose to build KMP projects. For the Android part, how does this works with the last stable AGP (currently 4.0.2) instead of the 7.0.0-alpha used for Android application development ?
    j
    a
    2 replies · 3 participants
  • p

    PHondogo

    03/25/2021, 4:08 PM
    Hello! I have kotlin multiplatform with several JVM targets. When I'm applying org.jetbrains.compose gradle plugin, it applies to all JVM targets. I need this plugin aplIyed to only specified targets. I was trying to find this possablity in source of this plugin, but found only selectivity by compilation platform (in master there is logic excludin js and native targets). Is there any plans to include this customization in gradle plugin extension, such that user can make appropriate settings in his project's gradle script. (reference to current selectivity logic: https://github.com/JetBrains/compose-jb/blob/b00aa7d5d3052daf54d8408e239ff116f3f32[…]lin/org/jetbrains/compose/ComposeCompilerKotlinSupportPlugin.kt)
    o
    a
    +2
    16 replies · 5 participants
  • g

    gbaldeck

    03/26/2021, 3:18 AM
    I'm having an issue with my compose app and too much CPU being used. There should be less than 1% of the CPU used but it is up to 20% in some cases and other apps slow down quite a bit. I do not believe this is a problem with compose or coroutines, but it may be a problem with how I am using them. The below links with line numbers show the chain of how I'm using a task that runs in a background coroutine. Does anyone know how I can optimize this? 1. Line 45 of https://github.com/recursiveg87/Grim-Locations/blob/master/src/main/kotlin/io/grimlocations/ui/view/EditorView.kt 2. Line 37 of https://github.com/recursiveg87/Grim-Locations/blob/master/src/main/kotlin/io/grimlocations/ui/viewmodel/event/EditorEvents.kt 3. Line 81 of https://github.com/recursiveg87/Grim-Locations/blob/master/src/main/kotlin/io/grimlocations/ui/viewmodel/reducer/EditorReducers.kt 4. Line 95 of https://github.com/recursiveg87/Grim-Locations/blob/master/src/main/kotlin/io/grimlocations/ui/viewmodel/reducer/EditorReducers.kt 5. LaunchEffect wrapper I used in item 1. https://github.com/recursiveg87/Grim-Locations/blob/master/src/main/kotlin/io/grimlocations/framework/util/LaunchedEffect.kt To give some more background on what I'm trying to do here. I am detecting if an app is running, and if it is I check if a file was changed, if it was then I load the file's contents into the compose app.
    z
    o
    +2
    9 replies · 5 participants
  • t

    Tlaster

    03/27/2021, 3:44 PM
    Hi! I've published a Compose library that focusing on writing the cross-platform application in pure Compose, and bring similar functionality of Jetpack ViewModel, LiveData, and Navigation to Jetbrains Compose, the source code is here: https://github.com/Tlaster/PreCompose
    🎉 5
    g
    2 replies · 2 participants
  • t

    theapache64

    03/27/2021, 4:01 PM
    Question: I tried the AsyncProfile but IMO, its not that good as android profiler, so do we have similar profiling tool available for CfD/JVM apps? 🤔
    1 reply · 1 participant
  • c

    CLOVIS

    03/28/2021, 9:04 AM
    Let's say I have a call to
    getUser(): Result<User>
    , what is the idiomatic way of displaying that in the UI? Before error handling was necessary, I had something like:
    val (user, setUser) = remember { mutableStateOf<User?>(null) }
    Button(onClick = { scope.launch { setUser(getUser()) } })
    
    if (user != null)
      // display the user
    But now that there's a Result in the way, I'm unsure what would be the “compose way” of doing things.
    d
    1 reply · 2 participants
  • y

    Yan Pujante

    03/28/2021, 3:51 PM
    I am trying to build an interface that looks similar to this animated screenshot: text and badges. As the window shrinks (or expand), the badges nicely wrap around on the next line. How would I do this with compose desktop?
    i
    2 replies · 2 participants
Powered by Linen
Title
y

Yan Pujante

03/28/2021, 3:51 PM
I am trying to build an interface that looks similar to this animated screenshot: text and badges. As the window shrinks (or expand), the badges nicely wrap around on the next line. How would I do this with compose desktop?
i

Igor Demin

03/28/2021, 4:23 PM
There is https://github.com/google/accompanist/tree/main/flowlayout But currently you can't depend on this library in the desktop target, and you have to copy-paste code from there. (in the future we will figure something out, how to unify android/desktop libraries)
👍 3
y

Yan Pujante

03/28/2021, 5:20 PM
thank you this works fine!
View count: 1