https://kotlinlang.org logo
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
  • s

    S.

    04/24/2022, 7:06 PM
    I noticed performance issues with
    DropdownMenu
    when it contains a lot of items while
    LazyColumn
    with the same amount of items works just fine. It doesn't lag while scrolling but it takes ages to show up and update it's content. is this a known issue and dropdowns are simply not cut out for >100 items or is the problem rather in my code?
    ➕ 3
    m
    • 2
    • 2
  • l

    Landry Norris

    04/24/2022, 9:09 PM
    In one of my projects, I need to use 1.6.20 which is only supported on 1.2.0-alpha08 of the compose compiler. I know the Android dsl allows us to override the compose compiler version. Is there a way to override this on a desktop/web project? I'm not using Android with this project.
    h
    • 2
    • 4
  • s

    spierce7

    04/25/2022, 8:20 AM
    Using the Kotlin JVM plugin I can iterate over all the jar dependencies by doing something like this:
    sourceSets.getByName("main").runtimeClasspath.filter { it.path.endsWith(".jar") }
    How would I get the same data in the Multiplatform Plugin for the JVM source set? I'm trying to get a list of all jars so that I can run them through an obfuscator. Everyone else I've seen attempt this seems to be using the jvm plugin, not multiplatform
    t
    • 2
    • 1
  • a

    Alina Grebenkina

    04/25/2022, 2:10 PM
    Calling all Kotlin desktop developers! We are looking for new ways to make your experience more convenient, and we’d love to get your opinions about what is good and what can be improved. Take this survey to help us make Kotlin better: ➡️ https://surveys.jetbrains.com/s3/sl-kotlin-desktop-developers-survey
    🤔 2
    ✅ 2
    d
    m
    +6
    • 9
    • 11
  • s

    spierce7

    04/25/2022, 9:15 PM
    I’ve added r8 to my compose desktop build. My app runs, but the window doesn’t show for some reason. I don’t see any exceptions and no errors. What’s the correct way to go about debugging this? I’ve been stuck on this for about 8 hours.
    k
    x
    • 3
    • 3
  • y

    ynsok

    04/26/2022, 7:40 AM
    I’ve configured Proguard to my liking based on the documentation which creates a nice obfuscated
    min.jar
    . The problem is that native distribution packages don’t want to use the obfuscated jar to create .dmg, even when I’ve clearly specified the location.
    import com.netguru.extensions.desktopMain
    import org.jetbrains.compose.compose
    import org.jetbrains.compose.desktop.application.dsl.TargetFormat
    
    buildscript {
        dependencies {
            classpath(libs.desktop.proguard)
        }
    }
    
    plugins {
        kotlin("multiplatform")
        alias(libs.plugins.compose)
    }
    
    group = libs.versions.project.group.get()
    version = libs.versions.project.version.get()
    
    kotlin {
        jvm("desktop")
        sourceSets {
            desktopMain {
                dependencies {
                    implementation(compose.desktop.currentOs)
                    implementation(project(":application"))
                }
            }
        }
    }
    
    compose.desktop {
        application {
            mainClass = "MainKt"
    
            nativeDistributions {
                targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
                packageName = libs.versions.desktop.packageName.get()
                packageVersion = libs.versions.desktop.packageVersion.get()
            }
            disableDefaultConfiguration()
            from(kotlin.targets["desktop"])
            val file: File? =
                fileTree("build/compose/jars").files.firstOrNull { file: File -> file.name.contains(".min.jar") }
            mainJar.set(file)
        }
    }
    tasks.register("createDesktopPackage") {
        group = "desktop package"
        dependsOn("obfuscate")
        dependsOn("package")
    }
    
    tasks.register<proguard.gradle.ProGuardTask>("obfuscate") {
        val packageUberJarForCurrentOS by tasks.getting
        dependsOn(packageUberJarForCurrentOS)
        val files = packageUberJarForCurrentOS.outputs.files
        injars(files)
        outjars(files.map { file -> File(file.parentFile, "${file.nameWithoutExtension}.min.jar") })
    
        val library = if (System.getProperty("java.version").startsWith("1.")) "lib/rt.jar" else "jmods"
        libraryjars("${System.getProperty("java.home")}/$library")
    
        configuration("<http://proguard-rules.pro|proguard-rules.pro>")
    }
    m
    s
    • 3
    • 4
  • s

    Slackbot

    04/27/2022, 11:48 AM
    This message was deleted.
    m
    b
    • 3
    • 2
  • d

    Dragos Rachieru

    04/27/2022, 2:13 PM
    Hello, I want to start adding support for
    js
    and
    ios
    in my app using the dev builds, but they don't support
    material3
    yet. Going through the code here I have found that in the
    build.gradle
    these platforms are not defined. Can you add
    js
    and
    darwin
    in the next version? I saw that there's only one file to create an actual which is just something that returns some hardcoded strings and can be copied from desktop.
    c
    • 2
    • 2
  • e

    eygraber

    04/28/2022, 10:32 PM
    I updated compose from
    1.2.0-alpha01-dev620
    to
    1.2.0-alpha01-dev675
    and it isn't getting found. The latest version on maven central is `dev620`:
    Could not find org.jetbrains.compose.material:material:1.2.0-alpha01-dev675.
         Searched in the following locations:
           - <https://repo.maven.apache.org/maven2/org/jetbrains/compose/material/material/1.2.0-alpha01-dev675/material-1.2.0-alpha01-dev675.pom>
           - <https://oss.sonatype.org/content/repositories/snapshots/org/jetbrains/compose/material/material/1.2.0-alpha01-dev675/material-1.2.0-alpha01-dev675.pom>
           - <https://s01.oss.sonatype.org/content/repositories/snapshots/org/jetbrains/compose/material/material/1.2.0-alpha01-dev675/material-1.2.0-alpha01-dev675.pom>
    e
    k
    • 3
    • 8
  • l

    lazt omen

    04/29/2022, 6:37 AM
    Hi, I'm new to compose. I wanted to know if there is an existing opinionated frameworks established around of compose that provides a standard structure for things like routing, state management and internationalization.
    c
    a
    • 3
    • 16
  • g

    galex

    04/29/2022, 10:08 AM
    Crossposting here :)
    d
    c
    +3
    • 6
    • 7
  • c

    Cody Mikol

    05/01/2022, 12:32 AM
    just like a . folder under the home dir?
    d
    e
    +2
    • 5
    • 8
  • c

    Cody Mikol

    05/01/2022, 3:53 PM
    What is the proper way to do something like absolutely positioned elements? I'm trying to make a selection drop down. Another window element seems like it could work, but doesn't seem like the right choice.
    k
    a
    • 3
    • 24
  • d

    David Herman

    05/01/2022, 8:25 PM
    I have some code where I need to handle the
    onKeyEvent
    for a
    Window
    , and it's giving me a
    KeyEvent
    , but I'm not sure how to tell if that event represents a typeable character or not without simply creating a huge mapping of Key to chars myself.
    • 1
    • 2
  • s

    Sean Proctor

    05/01/2022, 8:50 PM
    I'm currently porting an application from Jetpack Navigation to Decompose. I'm stuck on trying to pass a value from a child screen to the parent screen. With Jetpack Navigation I could observe some LiveData associated with the backstack entry and pass data to the parent backstack from the child. I would like to do this in a way that the parent and child are not coupled. Does anyone have a suggestion? My first thought was to maintain the state in the root component, but I don't see how to do that in a way that only the parent can observe it.
    a
    • 2
    • 23
  • d

    David Herman

    05/02/2022, 6:24 AM
    I have a window in which I will render a bunch of text with monospace font. What I'd like to do is initially size the window to some width by height as decided by the font, e.g. 80x50 means a window that can fit 80 characters wide and 50 lines tall. Is there any trivial way to check with size of text rendering without first creating a window?
    • 1
    • 4
  • g

    Guilherme Delgado

    05/02/2022, 9:01 PM
    Is there any
    android.graphics.Camera
    equivalent (for 3D operations) so we can perform code like this:
    val matrix = android.graphics.Matrix() //we have androidx.compose.ui.graphics.Matrix
    val camera = Camera()
        
    drawScope.drawIntoCanvas { canvas ->
            //camera transformations like camera.rotateZ, etc..
            camera.getMatrix(matrix)
            matrix.preTranslate(-x, -y)
            matrix.postTranslate(x, y)
    
            canvas.save()
            canvas.nativeCanvas.concat(matrix)
            drawScope.draw...
            canvas.restore()
    }
    Thanks.
    m
    • 2
    • 11
  • d

    David Herman

    05/02/2022, 10:36 PM
    Using the middle mouse to scroll a scrollbar doesn't seem to emit interactions (unlike manually dragging, which does). Is this intentional? I can see this being a mistake since Android doesn't have to handle middle mouse scroll as far as I understand?
    i
    • 2
    • 1
  • x

    xxfast

    05/03/2022, 5:10 AM
    Are you guys using any libraries for image loading? Looking for something like Coil, but can target desktop
    👀 1
    c
    d
    • 3
    • 2
  • g

    Grégory Lureau

    05/03/2022, 6:54 AM
    Hello! I'd want to draw a word cloud with Compose. Is there a project already available in the community or some tips to do one?
    👀 1
    p
    c
    • 3
    • 4
  • e

    eygraber

    05/03/2022, 9:22 AM
    I'm getting a
    NoSuchMethodError
    when using 1.2.0-alpha01-dev679 with an Android app but not jvm. Is that expected?
    java.lang.NoSuchMethodError: No static method isTraceInProgress()Z in class Landroidx/compose/runtime/ComposerKt; or its super classes
    • 1
    • 1
  • s

    Sean Proctor

    05/04/2022, 1:53 PM
    Has anyone managed to successfully build Kamel? I was planning to try to fix the bug with image rotation, but I can't manage to get it to build successfully.
    • 1
    • 1
  • a

    Arkadii Ivanov

    05/04/2022, 11:08 PM
    In a multiplatform module, I would like to use Compose for Android and Desktop in a shared source set (
    javaMain
    ), but keep assembling a normal iOS framework (to be consumed from an XCode project with SwiftUI), and also use Kotlin/React for UI in
    jsMain
    . I managed to put the Compose code into
    javaMain
    and
    android
    and
    desktop
    target compile just fine. I also managed to disable the Compose plugin for JS by adding
    compose.web.targets()
    , and it also compiles just fine. But I can't find a way to disable the Compose plugin for iOS. My iOS build fails with:
    Compilation failed: Cannot find the Composer class in the classpath
    Is there any workaround? I'm using Compose
    1.1.1
    .
    t
    • 2
    • 10
  • m

    mcpiroman

    05/05/2022, 9:41 AM
    I have just disovered that adding `Modifier.graphicsLayer()`to an element that can be (de)selected improves performance a lot. Do I understand correctly that without using any
    Modifier.graphicsLayer()
    , every recomposition causes whole screen/everything to redraw, even when not everything is recomposed?
    i
    • 2
    • 5
  • s

    spierce7

    05/06/2022, 2:47 PM
    Is there a way to turn a skia Image into a PNG? The fastest way that I’ve found is to turn it into an AWT image like this
    .toComposeImageBitmap().toAwtImage()
    and then use
    ImageIO
    to write PNG to an output stream or file. I’m wondering if there is a way to do skia Image to PNG directly.
    i
    • 2
    • 2
  • p

    Paul Woitaschek

    05/06/2022, 4:40 PM
    Is there a way to use the regular compose API in a web app?
    k
    • 2
    • 2
  • s

    spierce7

    05/06/2022, 4:47 PM
    There isn’t a version of constraint layout that works on Compose Desktop right?
    i
    • 2
    • 1
  • t

    Thomas

    05/06/2022, 5:46 PM
    Could the 1.2.0 builds please be rebased on https://android-review.googlesource.com/c/platform/frameworks/support/+/2073730/? This is a huge issue in compose and starting from build 1.2.0-alpha01-dev675 compose jb is affected. Version 1.2.0-alpha01-dev667 is not affected but is a lot older.
    👀 1
    i
    • 2
    • 7
  • c

    Cody Mikol

    05/07/2022, 2:43 PM
    Is there a simple way to make a ComposeWindow scale to the size of its contents?
    k
    • 2
    • 2
  • m

    Mitchell Syer

    05/07/2022, 3:58 PM
    I got a request for smooth-scrolling for my program. Is it possible for something like that to be implemented in a Compose Desktop program?
    m
    k
    • 3
    • 5
Powered by Linen
Title
m

Mitchell Syer

05/07/2022, 3:58 PM
I got a request for smooth-scrolling for my program. Is it possible for something like that to be implemented in a Compose Desktop program?
m

Michael Paus

05/07/2022, 6:50 PM
How do you define “smooth-scrolling”? That should be the default if you do not do something completely wrong.
m

Mitchell Syer

05/07/2022, 6:54 PM
Well, non-instant scroll to position. I have standard LazyColumns and they all scroll to the next position(using scroll wheel) instantly.
m

Michael Paus

05/07/2022, 7:23 PM
Ok, then you have a different definition of “smooth-scrolling” as I have. I’d rather call this animated scrolling or something like this.
m

Mitchell Syer

05/07/2022, 7:28 PM
Firefox and a few other applications have smooth scroll settings that do what I describe, so not sure what else would be called
smooth-scrolling
😄
k

Kirill Grouchnikov

05/08/2022, 4:06 AM
https://pavelfatin.com/scrolling-with-pleasure/ if you have a couple hours to kill
👍 1
View count: 2