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

    nuhkoca

    10/05/2022, 3:13 PM
    Hello, is it possible to animate color or show/hide Canvas views with animation?
    z
    • 2
    • 1
  • m

    Mini

    10/05/2022, 3:33 PM
    How could I achieve a row that behaves like this? I want the box(image) to be square, and the same height as the text. I can’t measure the box first, because then I wouldn’t know the text height, and I can’t measure the Text first, as I wouldn’t know the box width 🤔
    b
    k
    e
    • 4
    • 7
  • e

    Eganathan R

    10/05/2022, 3:40 PM
    Is there a Date Range picker on compose ? for date there we used DatePickerDialog but for Date Range picker we are unable to find a solution.
  • r

    reactormonk

    10/05/2022, 4:53 PM
    I have this little abomination of a debug view, but it doesn't show any text at all - the buttons in the top bar appear just fine, but no output. https://gist.github.com/reactormonk/45892c2ba8dcc7b0e5f9d583029e5827
    c
    • 2
    • 4
  • r

    Rick Regan

    10/05/2022, 6:14 PM
    I’m using
    LazyColumn
    with
    itemsIndexed
    with keys and have
    Modifier.animateItemPlacement()
    on my items. The list of items is immutable inside a mutableStateOf(). I can delete items one at a time (replacing with a new immutable list) and the animations appear to work as expected. However, I am confused by this comment from the documentation on animateItemPlacement(): “Aside from reorderings, item animations for additions and removals is currently in development.” (I am using Compose 1.3.0-beta03 and Material 3 1.0.0-beta03, the version prior to what just came out today.) Is that note out of date, does it not apply to my case, or am I just lucky?
    a
    • 2
    • 4
  • s

    Simon Wanbua

    10/05/2022, 6:21 PM
    Hey, I am having this issue whereby Textfield does not lose focus on clicking out of it. After looking around, I saw a suggestion whereby you can add
    pointerInput
    modifier with
    detectTapGestures
    to your Parent layout. However, this can get messy when reusing the textfield in multiple places. Any suggestions around this?
    z
    • 2
    • 9
  • a

    Ahaisting

    10/05/2022, 7:36 PM
    Does anyone have an impression about why
    .animateContentSize()
    works when expanding content, but not when contracting/shrinking it? details and example in thread 🧵👇
    c
    d
    • 3
    • 7
  • p

    Paul Woitaschek

    10/05/2022, 8:33 PM
    Hmmm… https://developer.android.com/jetpack/androidx/releases/compose-material3#1.0.0-rc01
    Version 1.0.0-beta03 contains these commits.
    Was that on purpose? 🤔
    j
    • 2
    • 4
  • a

    Afzal Najam

    10/06/2022, 2:19 AM
    Is it frowned upon to comment on open PRs in AOSP? (Specifically related to Compose)
    r
    z
    e
    • 4
    • 3
  • s

    Scott Kruse

    10/06/2022, 3:49 AM
    Does anyone know the current status of compose support with Android TV? I saw some focus related updates in the compose changelog (e.g Improved behavior with physical keyboard or TV remote) but haven’t seen any specific leanback related updates or plans on the compose roadmap. Anyone have any info / experience on the subject?
    t
    • 2
    • 2
  • z

    zt

    10/06/2022, 4:58 AM
    Are bottom sheets gonna be added to the material 3 library anytime soon? I'd like to be able to use it without having to do my own implementation, and not having another library
    j
    • 2
    • 1
  • c

    coooldoggy

    10/06/2022, 5:13 AM
    Does Anyone have issue using ModalBottomSheetlayout with textfield using compose? Keypad keep overlaying on BottomSheet’s textfield component. I have tried imepadding() options but it doesn’t work. Only option that did work was fake input spacebar on textfield. If I input something, bottomsheet pops up above keypad but if not it doesn’t. Unfortunately I couldn’t find any better solution so far, so asking in the channel if anyone has better solution. thx!
    c
    • 2
    • 1
  • l

    lilypuchi

    10/06/2022, 6:32 AM
    Not a native English speaker but couldn’t figure out this test case too https://android-review.googlesource.com/c/platform/frameworks/support/+/2218466/4/compose/ui[…]/kotlin/androidx/compose/ui/text/style/HyphensTest.kt
    z
    a
    s
    • 4
    • 23
  • s

    Slackbot

    10/06/2022, 8:10 AM
    This message was deleted.
  • d

    Djaka Pradana Jaya Priambudi

    10/06/2022, 11:26 AM
    For anyone that's using cash app's molecule like pattern for presenter, i would like to ask for a feedback for the code that I write that follows compose based presenter. This code merge bunch of presenter into 1. For me it's easy to read and write, but i dont know from other people. https://github.com/DjakaTechnology/droidjam-managing-state-compose/blob/main/common/src/commonMain/kotlin/id/djaka/droidjam/common/ui/booking/BookingPresenter.kt Thank you
  • o

    oday

    10/06/2022, 11:57 AM
    is this how I would model the state for a list of results?
    data class EventsState(
        val events: List<EventComponent> = listOf(),
        val isLoading: Boolean = true,
        val errors: Errors = Errors.None
    )
    back in my switch case, I have a case for
    isLoading
    , another case for
    events.isNotEmpty()
    , another for
    errors.throwable != null
    and the final
    else
    where I’m assuming the events list is empty the issue is, when I first load up, and while the events list is coming back, I get the empty state why is that?
    isLoading
    starts off as true and the only time it becomes false is when the events come back, I update the state along with the isLoading in 1 go, when is it getting the chance to fall into the else?
    eventsState.value =
        eventsState.value.copy(events = it, isLoading = false, errors = Errors.None)
    a
    a
    • 3
    • 9
  • w

    willyrs

    10/06/2022, 12:24 PM
    Hey, I just started with compose and I have something like
    @Composable
    fun A() { }
    @Composable
    fun B() {}
    I start in A, then I navController.navigate() to B. Then, I go back by pressing the back button and A is recreated from scratch, as the LifecycleEventObservers passes the on_create, on_start and on_resume, like this: A: ON_CREATE A: ON_START A: ON_RESUME navigating to B B: ON_CREATE B: ON_START B: ON_RESUME back button A: ON_CREATE A: ON_START A: ON_RESUME Is there something wrong in my code, or is this the expected behaviour? I don't want A to be recreated every time I go back to it
    i
    r
    • 3
    • 16
  • j

    jannis

    10/06/2022, 1:51 PM
    I use this code:
    var text by remember { mutableStateOf("") }
    TextField(
        value = text,
        onValueChange = { text = it }
    )
    Button(onClick = { text = "A different text." }) {
        Text("paste")
    }
    z
    • 2
    • 5
  • c

    czuckie

    10/06/2022, 10:14 PM
    Has anyone had any luck embedding compose in a Flutter application? Trying to sneak in a cheeky bit in an AlertDialog via a
    ComposeView()
    but getting:
    java.lang.IllegalStateException: ViewTreeLifecycleOwner not found from androidx.appcompat.widget.AlertDialogLayout
    i
    a
    • 3
    • 8
  • c

    Colton Idle

    10/07/2022, 1:54 AM
    Compose updates! Some things that stood out to me: Version 1.3.0-rc01 • Added new experimental API Hyphens to support automatic hyphenation in Text (Iaa869) • Support negative spacings in lazy lists and grids • Improve Snapping animations • Fixed
    ArrayIndexOutOfBoundsException
    coming from the slot table (b/249076084) • Fixed
    LazyColumn
    memory leak -
    onModifierLocalsUpdated
    was not being called with the default value when modifiers were reused (b/230168389) Old-ish... but just a reminder that Version 1.3.2 supports Kotlin 1.7.20
  • j

    Jialiwei2011

    10/07/2022, 4:14 AM
    l
  • z

    Zoltan Demant

    10/07/2022, 4:20 AM
    Key "..." was already used. If you are using LazyColumn/Row please make sure you provide a unique key for each item.
    For crashes like these, is there any work being done to improve the stack traces? I have a billion LazyColumn/Rows in my project, and while the error message explains the issue perfectly, I have zero insight into where it actually happens.
    a
    • 2
    • 3
  • g

    Grigory Panko

    10/07/2022, 4:42 AM
    Is it possible to mark concrete 3rd party dependency classes as Immutable or Stable, like via some compiler plugin option? My current use-case is Joda Time where most classes are immutable, but this is applicable for basically any library with immutable model classes.
    j
    j
    • 3
    • 3
  • a

    Aaron Waller

    10/07/2022, 10:43 AM
    Hey, the Dropdown Menu inside my LazyVerticalGrid items is causing recomposition every time I swipe my HorizontalPager. Removing the Dropdown Menu is causing no recomposition.
    DropdownMenu(
        expanded = showMenu,
        onDismissRequest = { showMenu = false }) {
        DropdownMenuItem(onClick = {
    
        }) {
            Text(text = "Share")
        }
    }
    This is inside my PostItem which is inside my LazyVerticalGrid. Unfortunately, this is causing a huge frame drop because all the AsyncImages contained in the PostItems are recomposed.
    • 1
    • 1
  • r

    Rizwan Minhas

    10/07/2022, 11:39 AM
    Hey, I am using bunch of experimental Apis in my jetpack compose App e.g; Accompanist Permissions library and now I’m close to production launch. Should I replace these experimental Apis with some other workaround before the launch or is it fine ?
    c
    • 2
    • 2
  • j

    Jhonatan Sabadi

    10/07/2022, 2:31 PM
    You can remove ripple effect
    .clickable(
                    interactionSource = MutableInteractionSource(),
                    indication = null,
                    onClick = { ... }
                )
    Or, if you want ripple effect, you can get swipeable state and check if currentValue is equal to 1 (final swipe), and send ripple to it.
    .clickable(
                    interactionSource = MutableInteractionSource(),
                    indication = if(state.currentValue < 1 ) null else rememberRipple(),
                    onClick = { ... }
                )
    a
    m
    +3
    • 6
    • 17
  • a

    Afzal Najam

    10/07/2022, 5:34 PM
    I was running an infinite “animation” using a Canvas and the code in 🧵. Weirdly, a UI test kept failing because the Node tree didn’t contain this Composable at all, nor the Snackbar that I was checking if it was displayed. Visually, both were being displayed. When I replaced
    withFrameMillis
    to
    withInfiniteAnimationFrameMillis
    , in the code, the UI test passed and the Node tree was correct. My question is, is this a bug I should file?
    z
    • 2
    • 3
  • v

    Vlad Ostaci

    10/07/2022, 6:09 PM
    I'm trying to solve this https://stackoverflow.com/questions/73982699/make-text-selectable-using-the-mouse Text selection is not working as expected.
    s
    • 2
    • 2
  • s

    Sebastian Höbarth

    10/07/2022, 6:51 PM
    I use
    ModalBottomSheetLayout
    and
    bottomSheet
    from Accompanist. Does someone know if there is a support for foldables/large screens? The M3 guidelines suggest a max width of
    640dp
    , but I can’t seem to figure out where to set it. Is there a best practice example somewhere? Thanks for your help
    d
    j
    • 3
    • 6
  • r

    Ronald Toshkollari

    10/07/2022, 8:15 PM
    Hello everyone, I have a question if I have a list with X objects and If I change a property (with copy() ) on that list and then resubmit it on a LazyColumn. The LazyColumn will recompose every single item because I added a new list or it is smart enough to understand the that only 1 item changed and it will skip the recomposition on the other elements ?
    m
    • 2
    • 1
Powered by Linen
Title
r

Ronald Toshkollari

10/07/2022, 8:15 PM
Hello everyone, I have a question if I have a list with X objects and If I change a property (with copy() ) on that list and then resubmit it on a LazyColumn. The LazyColumn will recompose every single item because I added a new list or it is smart enough to understand the that only 1 item changed and it will skip the recomposition on the other elements ?
m

mkrussel

10/07/2022, 8:27 PM
I believe LazyColumn by default using index for the key for remembering the composition. You need to create an item key to avoid the recomposition. https://developer.android.com/jetpack/compose/lists#item-keys
View count: 8