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

    Abhishek Dewan

    12/28/2021, 6:24 PM
    Does anyone know of a good way of providing different styles for different lines of text in an
    TextField
    . I have a sort of working solution using a custom
    VisualTransformation
    however trying to see if there is a different way of achieving this.
    2 replies · 1 participant
  • t

    Tim Malseed

    12/29/2021, 3:57 AM
    Hey all. I’ve got an issue with instrumented tests running on Github Actions, where the compose
    assertIsDisplayed()
    is failing. I’m wondering if it’s possible that there could be a problem with these compose assertions running against a headless emulator? The tests seem to run fine on various emulators when I run them locally. Just not quite sure where to look to figure this one out..
    4 replies · 1 participant
  • g

    Gumiku

    12/29/2021, 8:51 AM
    Hi how can I detect touch event in compose without consume the event? For example,
    Box1(){
       Box2(){
       }
    }
    If there are two boxes in the screen, how can I detect touch event in Box1 but consume the event in Box2?
    1 reply · 1 participant
  • k

    Kulwinder Singh

    12/29/2021, 9:48 AM
    How can we pass initial parameters in jetpack compose ViewModel using Hilt
    @HiltViewModel
    class AboutVM @Inject constructor(
        private val profile: Profile,
    ) : ViewModel() {
    ...
    }
    How
    profile
    can be passed ? while creating viewmodel like below
    val vm = hiltViewModel<AboutVM>()
    g
    a
    3 replies · 3 participants
  • f

    Florian Walther (live streaming)

    12/29/2021, 12:26 PM
    My bottom navigation can't navigate to the start destination after opening a deep link. Any idea why?
    f
    4 replies · 2 participants
  • f

    Florian Walther (live streaming)

    12/29/2021, 1:14 PM
    What's the dismiss callback in the
    SwipeToDismiss
    composable?
    d
    l
    4 replies · 3 participants
  • b

    Bradleycorn

    12/29/2021, 4:36 PM
    I built some nifty "loading buttons" with animations...
    screen-20211229-112817~2.mp4
    👍🏼 1
    👍 12
    :kotlin-intensifies: 9
    :party-parrot: 4
    :jetpack-compose: 9
    s
    c
    7 replies · 3 participants
  • a

    Antoine Gagnon

    12/29/2021, 6:59 PM
    I’m having some issues with the
    pointerInput
    Modifier on a piece of text. I use it to get the click position and do some things with it, but my issue is that is override the default click behaviour as well. In my case, this means that with a
    SelectionContainer
    I can select my text, but clicking to deselect doesn’t work, the
    pointerInput
    consumes the click and doesn’t “transmit” it. Any idea on how to do that? Use the position and still transfer the click?
    t
    3 replies · 2 participants
  • t

    theapache64

    12/29/2021, 8:00 PM
    How do I know if a composable is fully visible? 🧵
    1 reply · 1 participant
  • b

    Brian Donovan

    12/29/2021, 8:06 PM
    Hi all, how do I move the text “Blog” to the middle of this white box?
    k
    l
    9 replies · 3 participants
  • b

    Brian Donovan

    12/29/2021, 9:33 PM
    Hey all, I am trying to do this dark transparent look. I was using alpha but it was hiding the background image and turning the text color from white to a lighter grey. Any help please
    k
    5 replies · 2 participants
  • f

    Florian Walther (live streaming)

    12/30/2021, 11:57 AM
    Is it okay to launch another coroutine inside
    LaunchedEffect
    by wrapping it inside a
    launch
    block? Otherwise the
    showSnackbar
    method blocks the coroutine because it's a
    suspend fun
    LaunchedEffect(Unit) {
        viewModel.events.collect { event ->
            when (event) {
                is RewardListViewModel.Event.ShowUndoRewardSnackbar -> {
                    launch {
                        val snackbarResult = scaffoldState.snackbarHostState.showSnackbar(
                            message = context.getString(R.string.reward_deleted),
                            actionLabel = context.getString(R.string.undo),
                        )
                        if (snackbarResult == SnackbarResult.ActionPerformed) {
                            viewModel.onUndoDeleteRewardConfirmed(event.reward)
                        }
                    }
                    Unit
                }
                is RewardListViewModel.Event.NavigateToEditRewardScreen -> {
                    navController.navigate(AddEditRewardScreenSpec.buildRoute(event.reward.id))
                }
            }.exhaustive
        }
    }
    d
    a
    +2
    11 replies · 5 participants
  • u

    Utkarsh Tiwari

    12/30/2021, 2:30 PM
    Hi, I have a vertical list of TextFields. Tapping any of those shows the keyboard. I want the focused item to automatically scroll above to be visible if it gets hidden behind the keyboard. How can I achieve this behavior?
    d
    1 reply · 2 participants
  • a

    Alexander Suraphel

    12/30/2021, 3:21 PM
    do i need the
    androidx.activity:activity-compose
    dependency if I have one activity application? What is the dependency for?
    d
    c
    6 replies · 3 participants
  • m

    myanmarking

    12/30/2021, 4:32 PM
    is there any immediate future plans to improve preview? Atm is the current bottleneck. too slow. Otherwise compose is dope
    :yes: 2
    c
    j
    +2
    9 replies · 5 participants
  • m

    Marcin Wisniowski

    12/30/2021, 6:34 PM
    I need to animate between colors, similar to animateColorAsState, but getting the intermediate values manually (e.g. get the color 0.3 of the way between color A and B). How do I access that color-cross-fade functionality without running an animation?
    ✅ 1
    a
    2 replies · 2 participants
  • a

    Andy Himberger

    12/30/2021, 7:29 PM
    I'm trying to workaround some limitations in the experimental material ModalBottomSheetLayout. Since this composable doesn't actually use Dialog like the view based materal BottomSheetDialog, we're not getting the automatic OS behavior to size and position the bottomsheet. (On Surface Duo devices bottomsheets don't span both screens obscuring content in the middle, instead they get positioned on the screen to the right when you app is spanned across both screens). I'm guessing the foldable device case will get handled by material library someday (though the androidx.window library is maybe not very convenient for a library to use with its async API to detect foldables), in the meantime, what would be a good workaround? (We have another case I guess Material won't care about, but we like to not use full width bottomsheets on really big displays) I've tried two things: (1) create a wrapper that replaces part of ModalBottomSheetLayout so I'm doing my own background Scrim and display of the content, then size/position a ModalBottomSheetLayout inside of that. Because Scrim() and ModalBottomSheetState.confirmStateChange are private in material, I have to duplicate a bit but not too much to get something that looks and behaves correctly. (2) set sheetBackgroundColor, elevation to be invisible, on my sheetcontent specify the background color, elevation, shape. This looks right but the interaction is a little wrong since you can swipe on transparent areas of bottomsheet content. I suppose another option is to use the view based BottomSheetDialog and setContent a separate compose tree there. or try to recreate ModalBottomSheetLayout using compose's Dialog infra. Other ideas?
    c
    1 reply · 2 participants
  • m

    myanmarking

    12/30/2021, 8:18 PM
    what’s the proper way to implement multi model bottom sheets in a screen (since the modalBottomSheetLayout accepts the screen content) ?
    c
    l
    2 replies · 3 participants
  • j

    Jamie

    12/31/2021, 3:30 AM
    relatively new to Kotlin, so apologies in advance if there's something dumb i'm missing 🙂 I'm currently experimenting with (Jetbrains) Compose and Decompose, and while I have a working implementation based on the Decompose samples, I'm wondering whether it's possible to use sealed classes as the exposed component value type as opposed to just a single data class as per the samples? I've tried to update as expected but this falls apart when updating the component value as there's no
    copy()
    method or equivalent to replicate the samples when invoking value.reduce {}, and the widget doesn't recompose when the observed
    state
    value changes. What am I missing? EDIT: creating a wrapper
    data class
    to hold my
    sealed class
    did the trick to make it play nice, though very much open to suggestions if there's a better way to handle this!
    DecomposeExample_kt
    a
    z
    4 replies · 3 participants
  • l

    loloof64

    12/31/2021, 9:20 AM
    Hi ! I know that there's something wrong in my
    @Composable
    code, but don't know what. Because when I rotate the device, the value of
    pageIndex
    switches between two values instead of keeping the same value. More in 🧵
    4 replies · 1 participant
  • t

    theapache64

    12/31/2021, 12:27 PM
    Why
    parentLayoutCoordinates.size
    is
    0 x 0
    for the first few items? More inside 🧵
    ➕ 3
    👀 1
    a
    4 replies · 2 participants
  • f

    FunkyMuse

    12/31/2021, 12:33 PM
    Hey guys, i'm trying to build a preview with the preview parameter but it's only shown in light mode even tho there's another preview parameter attached to it as it forces the UIMode to be night, tried making the preview composable not private, the preview class not internal, doesn't work, code in thread, AS info in the picture
    ➕ 1
    c
    15 replies · 2 participants
  • m

    myanmarking

    12/31/2021, 2:01 PM
    Did any1 managed to find a good solution to multiple bottom sheets? It’s so weird the api. It is impractical
    z
    3 replies · 2 participants
  • c

    Chris Fillmore

    12/31/2021, 4:20 PM
    I’m having an issue with Compose
    @Preview
    rendering. This shows up as “Render problem” in the preview pane:
    java.lang.NullPointerException: Parameter specified as non-null is null
    The parameter referenced in the message is just a
    text: String
    which gets passed to a text composable
    Text(text = text)
    m
    c
    10 replies · 3 participants
  • a

    Afzal Najam

    12/31/2021, 8:13 PM
    Anybody tried LazyColumn or LazyGrid on Android TV? For me, they don't scroll down. See the attached video, first example is with
    LazyColumn
    , second one is just
    Column
    with
    verticalScroll
    modifier. Edit: Looks like this is related to d-pad navigation because when I swipe using
    scrcpy
    , all the rows are there.
    Screen Recording 2021-12-31 at 3.12.05 PM.mov
    s
    j
    +2
    12 replies · 5 participants
  • b

    Bojie Jiang

    01/01/2022, 3:08 AM
    What’s custom shape-to-component mapping? (pic1), I’ve tired, but I think I cannot apply to components automatically.
    c
    2 replies · 2 participants
  • v

    Vivek Sharma

    01/01/2022, 11:32 AM
    Is there anything that can detect drag gesture started and stopped I am currently using it like this:
    Modifier.pointerInput(Unit) {
        detectTransformGestures { centroid, pan, zoom, rotation ->
            offset += pan
            scale *= zoom
        }
    }
    I am zooming the image and I need to know when the zoom drag is ended like we removed the fingers? Further info 👇
    a
    m
    16 replies · 3 participants
  • r

    rsktash

    01/01/2022, 4:30 PM
    Hi I’ve published a new app for production Now i’m receiving crash reports Any help is appreciated
    c
    f
    +1
    11 replies · 4 participants
  • j

    Jamie

    01/02/2022, 4:17 AM
    potentially dumb question but I haven't found the answer to be documented anywhere: is it possible to compile (Jetbrains Compose for Desktop) a Deb package on MacOS M1? It seems even running the
    packageDeb
    Gradle task instead builds a MacOS app
    e
    c
    5 replies · 3 participants
  • s

    Simon Lin

    01/02/2022, 2:31 PM
    If I have a
    Recipe
    compose to show
    Recipe
    data. Is it good to use the same name on both compose fun and data class?
    k
    p
    4 replies · 3 participants
Powered by Linen
Title
s

Simon Lin

01/02/2022, 2:31 PM
If I have a
Recipe
compose to show
Recipe
data. Is it good to use the same name on both compose fun and data class?
k

K Merle

01/02/2022, 5:49 PM
You can use
RecipeItem
for compose function.
p

Paul Woitaschek

01/02/2022, 6:34 PM
Or RecipeRow, RecipeCard, whatever applies
s

Simon Lin

01/03/2022, 5:08 AM
So it is not recommended to use same name?
k

K Merle

01/03/2022, 6:37 AM
I don't think it says anywhere to not use it, but looking at other people code you can see what's common convention. You can use it.
:thumbsup_all: 1
View count: 1