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

    Edward

    07/07/2022, 4:41 AM
    Hi Community, is there a way build a button with cut out text, so I can see the background through the letters?
  • a

    allan.conda

    07/07/2022, 6:28 AM
    Based on Compose Compiler Metrics, it seems
    Painter
    and
    Icon
    are unstable and keeping the function as non-skippable. Any ideas how else I could optimize my Coil Image Grid? Or does coil already able to optimize this somehow. It’s quite slow
    b
    • 2
    • 6
  • a

    allan.conda

    07/07/2022, 6:57 AM
    navigation argument
    defaultValue
    cannot be dynamic? I had the idea of generating an id by default to identify a particular nested navigation scope and share an instance of a class among them.
  • s

    Stylianos Gakis

    07/07/2022, 7:46 AM
    What version should
    kotlinCompilerExtensionVersion
    be targeting? I always thought it should be the compiler version, but on the docs it shows that it can be
    1.3.0-alpha01
    a version that right above doesn’t seem to come from the compiler dependency since it only has the 1.2.0 stable release. Am I misunderstanding something or is this a documentation bug?
    b
    a
    • 3
    • 8
  • n

    nuhkoca

    07/07/2022, 9:27 AM
    Hello, is `TextButton`’s
    contentPadding
    depending on text length? Longer text lesser contentPadding or?
    s
    • 2
    • 9
  • s

    Slackbot

    07/07/2022, 9:40 AM
    This message was deleted.
    g
    r
    • 3
    • 2
  • g

    Gonzalo Renedo

    07/07/2022, 2:04 PM
    Hi!
    👋 5
  • t

    Tower Guidev2

    07/07/2022, 2:45 PM
    Hi is it just me? or are Jetpack Compose "Out of the box" Dropdown menus "underwhelming"? shouldnt it be easier to add item dividers, ripple effect when items clicked, elevation changes etc or am i missing something? 🤔
    👍🏻 1
    k
    c
    • 3
    • 6
  • s

    Stefan Oltmann

    07/07/2022, 5:13 PM
    I have a
    LazyVerticalGrid
    with a lot of boxes in it (containing images, it's a photo app). Each Box has a
    Modifier.clickable { openElement(element) }
    on it. If I remove this modifier my scroll speed is much faster. It seems to be a problem to create the lambda and modifier over and over again for each of the thousands of entries as a user scrolls by. Is there any way I can solve this in a away without creating a lambda for each entry?
    👀 1
    l
    • 2
    • 2
  • d

    Daniel Okanin

    07/07/2022, 6:39 PM
    EDIT: Hi everyone! I turn on the compiler flag for the compose metrics and I dont understand the following case- Why the VisibilityTrackerListener is unstable? is just an interface defines under module who run and compiled compose
    restartable scheme("[androidx.compose.ui.UiComposable]") fun ShoppingCarouselCardItem(
      stable card: ShoppingCarouselViewItem
      stable index: Int
      onClickListener: OnClickEvent? = @static null
      unstable carouselVisibilityTrackerListener: VisibilityTrackerListener<BaseEntry>? = @static null
      unstable onCarouselHidden: MutableLiveData<OnCarouselHidden>
    e
    l
    s
    • 4
    • 9
  • j

    Javier

    07/07/2022, 7:17 PM
    Has anyone tried to use K2 with Compose?
    l
    e
    • 3
    • 5
  • s

    Sean Proctor

    07/07/2022, 9:35 PM
    SelectionContainer seems to intercept all clicks. I'm trying to wrap ClickableText elements in a SelectionContainer. Any ideas? SelectionContainer seems to be very limited and all of the interesting stuff is internal.
    • 1
    • 2
  • n

    Nathan Castlehow

    07/08/2022, 1:54 AM
    Hi All, Would love to chat with people who have used compose to create an Android TV app? I know some of the latest dpad support items are still landing but would love to see where people have gotten to. We are running the latest compose version in our android tv app and still have some issues related to scrolling so would love to see how others worked around it? We are trying to avoid having to switch back to classic views for a chunk of the app.
    ➕ 2
  • j

    jasu

    07/08/2022, 6:44 AM
    *In Compose navigation h*ow can I go back to the previous destination without making it recompose? I have screen A which launches B, B pops up & provides some data back to A. When B goes to A again I don’t want A to be recomposed. Is it possible?
    s
    s
    • 3
    • 6
  • p

    Paul Woitaschek

    07/08/2022, 7:30 AM
    How can I do a screenshot of a full composable? If I do a
    onRoot().capturetoImage()
    the image won’t be larger than the size of the screen. I also tried wrapping it in a vertical scrollable column and then setting a test tag but the screenshot never gets larger than the screen size
    ➕ 1
  • j

    Javier

    07/08/2022, 10:48 AM
    Is there a branch where I can track the state of Compose FIR implementation?
    s
    • 2
    • 7
  • d

    dorche

    07/08/2022, 11:01 AM
    I think I’ve hit a bug in Compose Material - is anyone else experiencing this? Basically
    BottomSheetScaffold
    is not rendering properly in Previews (only Preview as far as I can see) on
    androidx.compose.material:material:1.2.0-beta03
    but it does on the previous version -
    androidx.compose.material:material:1.2.0-beta02
    . More in 🧵
    j
    t
    • 3
    • 17
  • k

    kotlinforandroid

    07/08/2022, 2:53 PM
    I am trying to create a list of items similar to a todo list with a checkbox and some text next to it. I also want to have a shadow item that the user can change focus to. Once they type into it, a new "data item" gets created. The problem I encounter is that my shadow item is different from the newly created item. Thus the focus is lost. I am not sure how to correctly implement this. I tried it with
    key
    and this does sadly not work. I think I know why (the item is not at the same "position" in the composable and thus can't be the same). Code in thread. Any help is appreciated!
    s
    • 2
    • 6
  • m

    Marco Pierucci

    07/08/2022, 3:55 PM
    Hello hello! With the new Compose library versioning schema, could I have Compose Compiler on
    1.2.0
    and the remaining libs on
    1.0.5
    .Or does this require a min version (I.E 1.1.0) to work? Cheers!
    j
    • 2
    • 4
  • j

    Jorge Domínguez

    07/08/2022, 4:31 PM
    I'm trying to create a custom color scheme for Compose. According to the official docs it can be done like this:
    @Immutable
    data class CustomColors(
        val content: Color,
        val component: Color,
        val background: List<Color>
    )
    Then I'd use a
    CompositionLocal
    inside my custom theme to provide these colors. However, looking at different community samples I noticed that they do it like this:
    class AppColors(
        primary: Color,
        secondary: Color
    )
        var primary by mutableStateOf(primary)
            private set
        var secondary by mutableStateOf(secondary)
            private set
    
        fun copy(
            primary: Color = this.primary,
            secondary: Color = this.secondary
        ): AppColors = AppColors(
            primary,
            secondary
        )
        
        fun updateColorsFrom(other: AppColors) {
            primary = other.primary
            secondary = other.seconday
        }
    }
    Basically replicating the
    MaterialTheme
    Colors
    class implementation. My question is which approach should I follow? I understand that by using
    mutableStateOf()
    I can guarantee that Composables will react to individual color updates, but what if I know that my color scheme will never change at runtime? Is that the only reason to use
    mutableStateOf()
    ? Any thoughts on this will be appreciated
    l
    • 2
    • 2
  • o

    oday

    07/08/2022, 4:33 PM
    if I’d like to do something like this, this is a box with a surface inside and an icon inside the surface, sounds right?
    j
    a
    c
    • 4
    • 25
  • d

    Daniel Okanin

    07/08/2022, 4:44 PM
    Hello! I’m trying to help the compose compiler to mark the model as stable (because I have performance issue). So I have ImageDesctiptor - interface model that exists in module doesn’t run compose so I wrap the class in that way/ Where Im wrong?
    @Immutable
    data class ImmutableHolder<T>(val item: T)
    
    and I see that metrics:
    unstable class PhotoViewModelItem {
      unstable val imageDescriptor: ImmutableHolder<ImageDescriptor>?
      stable val isSaved: MutableState<Boolean>
      stable val photoType: PhotoType?
      stable val tagsCount: Int
      <runtime stability> = Unstable
    }
    ========
    runtime class ImmutableHolder {
      runtime val item: T
      <runtime stability> = Parameter(T)
    }
    m
    • 2
    • 1
  • m

    mattinger

    07/08/2022, 5:52 PM
    Does anyone know if i can get a BottomSheetNavigator to allow me to default to something other than 50% height?
    a
    j
    • 3
    • 7
  • t

    Travis Griggs

    07/08/2022, 11:50 PM
    As I try to learn Compose, I find myself really struggling with what is Good(tm) in a compose universe, what is unacceptable, and what is just distasteful. Most of my Android experience is a couple years back, and I'm currently trying to port some BLE scanning code that has lots of references to Activities, and Intents, and RecyclerViews, but no ViewModels. So I end up having to ask myself "is there a better/newer way to do this, or is this a hold your nose moment." I am curious if anyone has any decent up to date good book recommendations? I've done a few of the official sanctioned tutorials, but I feel I'm still missing a lot of how to weave Composable functions (I get that part pretty clear) with the more stateful rest of an Android app.
    s
    • 2
    • 2
  • b

    Brendan Campbell-hartzell

    07/09/2022, 3:01 AM
    If I have a separate file with my compose code, is there a way to access the android R.xxx.whatever ids?
    R
    seems to be available, but it doesn't recognize
    .string
    or
    .drawable
    outside of an Activity class.
    :not-kotlin: 3
    s
    • 2
    • 3
  • m

    Marcin Wisniowski

    07/09/2022, 9:20 AM
    How would I go about adding a badge to a
    NavigationBarItem
    of a Material 3 bottom navigation bar? My initial attempt was to just wrap it in a
    Box
    and overlay the badge, but it seems
    NavigationBarItem
    has to be placed directly in the
    NavigationBar
    , so I cannot do that.
    ✅ 1
    • 1
    • 1
  • d

    dimsuz

    07/09/2022, 10:18 AM
    I noticed that
    IconButton
    (on the screenshot it's inside a
    Button
    content slot) has "rounded" tap area. When rendered using Compose Desktop I can actually misclick with the mouse in the corner leading to the whole button being pressed while I'd like a "dropdown" area to react instead. Can I somehow make it to be square?
    • 1
    • 1
  • n

    nuhkoca

    07/09/2022, 11:43 AM
    Hello, how do you keep state of bottom tabs? Whenever I switch back and forth between tabs, everything is recreated and recalled. Code and video in thread
    d
    i
    • 3
    • 11
  • s

    Slackbot

    07/09/2022, 5:25 PM
    This message was deleted.
  • s

    Slackbot

    07/09/2022, 7:10 PM
    This message was deleted.
Powered by Linen
Title
s

Slackbot

07/09/2022, 7:10 PM
This message was deleted.
View count: 1