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

    Yoshio Schermer

    02/21/2022, 1:51 PM
    What chart library do y’all recommend or use for Compose projects? My use case is pie charts and line charts, but I’m having a hard time to find a Compose library for this and considering to use a View library instead. I’m trying to create something like the line chart here
    ➕ 5
    ☝️🏻 1
    ☝️ 1
    i
    • 2
    • 2
  • m

    mertceyhan

    02/21/2022, 2:01 PM
    Hello all! I was working on a single-line text field and our QA engineer has noticed in the copy paste case the cursor goes to second-line though we set
    singleLine = true
    on
    OutlinedTextField
    . I’ve checked the case on EditText that comes from View class but it worked well. Is this bug or something else? Here is the code:
    Column(modifier = Modifier.padding(16.dp)) {
        var outlinedTextFieldValue by remember { mutableStateOf("") }
        OutlinedTextField(
            value = outlinedTextFieldValue,
            onValueChange = { newValue ->
                outlinedTextFieldValue = newValue
            },
            placeholder = { Text(text = "OutlinedTextField") },
            singleLine = true,
            maxLines = 1
        )
    
    
        AndroidView(factory = { context ->
            EditText(context).apply {
                hint = "EditText build by AndroidView"
                maxLines = 1
                isSingleLine = true
            }
        })
    }
    screen-20220221-145402.mp4
    s
    • 2
    • 9
  • i

    Ivan Skiridomov

    02/21/2022, 3:35 PM
    How can I manage layout programmatically in my app? I want to add more columns in a row with specific component inside by button click. How can I do it?
    f
    a
    • 3
    • 14
  • r

    Rajashekar

    02/21/2022, 4:30 PM
    I have implemented a bottom sheet and it expands once the screen is opened. Problem is, sheet slides from the top of the screen instead of bottom, please see the video. Any clue for what I'm doing wrong?
    val bottomSheetScaffoldState = rememberBottomSheetScaffoldState(
        bottomSheetState = rememberBottomSheetState(
            initialValue = BottomSheetValue.Expanded,
            animationSpec = tween(durationMillis = 500, delayMillis = 100),
        )
    )
    
    Surface(
        color = MaterialTheme.colors.primary
    ) {
        BottomSheetScaffold(
            sheetShape = RectangleShape,
            backgroundColor = MaterialTheme.colors.primary,
            bottomSheetScaffoldState = bottomSheetScaffoldState,
            sheetPeekHeight = 0.dp,
            sheetGesturesEnabled = false,
            sheetContent = { DialPadContent(viewModel, scaffoldState) },
        ) {
            // Screen content
        }
    }
    screen-20220221-214444.mp4
    j
    • 2
    • 3
  • l

    lbarqueira

    02/21/2022, 5:05 PM
    Material You dynamic colors not working on Android 12 emulator. Any reason for not working?
    s
    • 2
    • 2
  • s

    ste

    02/21/2022, 6:00 PM
    Hi all, I was wondering what's the proper way to handle composables which may have different components inside and may have a slightly different behavior - it is better to differentiate them by their name (e.g.
    PrimaryButton
    ,
    PrimaryIconButton
    ) with more LOC as side effect, or by taking multiple parameters (
    PrimaryButton(icon: Int?)
    ) with more control flow structures and overall complexity as a side effect?
    a
    • 2
    • 2
  • a

    adjpd

    02/21/2022, 6:46 PM
    When when you publish to the Play Store to the closed track you get a pre-launch report with videos. With Activities/Fragments/Videos your app is used and you see the results of such usage in the video. But with a Compose app, nothing happens in the those videos. Are Google planning to fix this?
    a
    a
    • 3
    • 3
  • t

    theapache64

    02/21/2022, 7:05 PM
    [✅ SOLVED]: What’s 
    key
     actually doing to slot table? 🤔 🧵
    l
    j
    • 3
    • 6
  • d

    Dan MacNeil

    02/21/2022, 7:45 PM
    I'm having an issue with TextButtons in Compose 1.1.0.
    Info:
    When you give a button a background color it takes up a certain rectangular area.
    If you add a border it draws a rectangle that is larger vertically.
    --
    The problem I'm having is when I add a background Modifier with a gradient fill.
    In Compose 1.0.5 the gradient fill takes up the same area as the button background color.
    In Compose 1.1.0 the gradient fill takes the larger area the same as the border takes.
    This makes very tall ugly buttons. Is there a way to get the older functionality?
    a
    • 2
    • 3
  • r

    r4phab

    02/22/2022, 7:49 AM
    Hi everyone, I’m trying to use the new Google Maps Compose sdk but I can’t figure out how to get the map bounds ? If anyone can tell me if it’s possible or do I need to try to calcule it from the location and zoom level ? 🙏
    b
    • 2
    • 2
  • s

    sunnat629

    02/22/2022, 7:58 AM
    I want to use this type linearGradient for my background and how I can use Color/Brush as background in
    Scaffold
    . Thanks
    g
    • 2
    • 2
  • b

    Bino

    02/22/2022, 8:19 AM
    What is a good approach to observe a flow like with
    flowWithLifecycle
    and keep na uiState in the viewmodel?
    flowWithLifecycle
    needs the views lifecycleOwner and should not be placed into the viewmodel. But the content of the observed flow should be placed inside the viewmodel to reduce the composable.
    As mentioned in this article by @Manuel Vivo it could sometimes be a use case
    m
    m
    s
    • 4
    • 6
  • m

    martinsumera

    02/22/2022, 10:55 AM
    Is it possible that that mutableStateOf doesn't cause recomposition. I have a flaky test and it looks like that recomposition is not happening sometimes and I can't find out why. (code is in the thread)
    m
    • 2
    • 6
  • t

    Tobias Gronbach

    02/22/2022, 1:01 PM
    Hi, I'm learning compose and was wondering if I can reuse a Modifier. I created a file 'Modifiers.kt' that contain modifiers I want to reuse, f.e.
    val dialogModifier = Modifier
        .padding(10.dp)
        .background(MaterialTheme.colors.surface)
        .width(400.dp)
    But then build is failing with: @Composable invocations can only happen from the context of a @Composable function . What am I doing wrong?
    a
    a
    +2
    • 5
    • 15
  • m

    Matti MK

    02/22/2022, 1:30 PM
    I’m starting to write tests for my compose UI. I plan to approach the testing from the perspective of unit testing, so testing different components of screens, and some screens in total, but not transitions, navigation and so on. So no E2E testing. I’ve been reading some blog posts and the docs, but would be happy to read on it more. Anyone happen to have good reference material, for example blog posts or projects to recommend? Thanks 👍
    m
    • 2
    • 3
  • k

    krshmbb

    02/22/2022, 1:53 PM
    Hey everyone. I'm building a Figma plugin that helps your convert Figma design to Jetpack compose. You can find it at https://www.figma.com/community/plugin/1063494652261429841/Upspeed---Convert-designs-to-Jetpack-Compose-(Alpha). I would love for you all to try it out and let me know what else you would like to see in it. Thanks!
    :kotlin-intensifies-purple: 5
    a
    a
    • 3
    • 4
  • j

    Jérémy CROS

    02/22/2022, 3:39 PM
    Hi guys! 🙂 We’ve add a recurring issue in our application rendering svg files in compose. And it’s getting to the point where it’s a deal breaker for us. The code is fairly simple:
    Icon(
        painter = painterResource(R.drawable.ic_where_am_i_navigation),
        contentDescription = stringResource(R.string.content_description_button_where_am_i),
        tint = iconTint
    )
    I’ll add screenshots of the poorly drawn image in a thread. Two remarks: 1) not all our icons have the issue in compose, most are fine and 2) those “faulty” files worked perfectly in XML (using the standard
    <ImageButton>
    ) Anything we’re missing?
    a
    • 2
    • 6
  • g

    Gagan Deep

    02/22/2022, 3:47 PM
    Hello!! Is there a way to measure the rendering time of Composables, or what is equivalent of
    onGlobalLayout
    in Compose world?
    w
    • 2
    • 15
  • s

    Slackbot

    02/22/2022, 4:47 PM
    This message was deleted.
    n
    • 2
    • 1
  • b

    Bradleycorn

    02/22/2022, 5:54 PM
    Navigation Question: when navigating to a route that takes some parameters (i.e. a route like
    path/to/products/{cateegory}/{id}
    ), I don’t want to just hard code strings throughout my application (like:
    navController.navigate("path/to/products/shirts/1234")
    . If that route ever changes, I have to find and update it throughout my application. I’m curious what sort of architecture others have used to address this? My current solution in the 🧵
    z
    p
    +2
    • 5
    • 12
  • i

    Ink

    02/22/2022, 8:18 PM
    How Can I detect when user stopped zooming Image and released fingers from the screen?
    • 1
    • 1
  • j

    james

    02/22/2022, 9:52 PM
    I am seeing a strange behaviour with ModalBottomSheetState.. previously when my ModalBottomSheet was on screen and the keyboard is opened, when I tapped to close the keyboard, the keyboard would hide as normal and nothing strange would occur as soon as I updated my Activity to have
    android:windowSoftInputMode="adjustResize"
    , whenever I hide the keyboard while that Modal is currently opened, the Modal re-animates in entirely, creating a really weird feeling UX. I've traced this back to `SwipeableState`'s internal function
    processNewAnchors()
    which is comparing the old and new anchors (obviously different since the whole container is resized) and then re-animating the Modal from closed to open, even though it was already open has anyone else seen a similar behaviour to this?
    j
    • 2
    • 1
  • r

    Ravi

    02/22/2022, 10:51 PM
    How to implement a 3d carousel in compose? 🧵
    p
    d
    • 3
    • 4
  • s

    Simon Stahl

    02/23/2022, 12:04 AM
    Hi there. I am getting a wrong progress from
    BottomSheetState
    when used in
    BottomSheetScaffold
    and decreasing the
    sheetPeekHeight
    . Example code in comment
    j
    c
    • 3
    • 17
  • s

    Satria Adi Putra

    02/23/2022, 8:06 AM
    Hi there I just migrate a screen in my app to compose, and firebase crashlytics report this 2 crash which I think is the same error. What's happening here? What causing the error? Thanks
    :thread-please: 3
    • 1
    • 1
  • z

    ziv kesten

    02/23/2022, 5:04 PM
    What is currently the best way to animate adding items to a column\lazy column?
    VID-20220223-WA0011.mp4
    a
    a
    • 3
    • 5
  • t

    trevjones

    02/23/2022, 5:28 PM
    is it just me that is finding the recommended way to navigate and share a scaffold is absolutely terrible? https://developer.android.com/jetpack/compose/navigation#bottom-nav seems highly unlikely that we would avoid god object style coupling with that pattern
    🔥 1
    a
    i
    • 3
    • 7
  • n

    Nat Strangerweather

    02/23/2022, 5:52 PM
    Using
    Modifier.clickable
    I still get no touch sound on my device. Was this ever reported, considered? Are there any workarounds?
    a
    z
    • 3
    • 5
  • y

    YASAN

    02/23/2022, 7:21 PM
    Is there a proper/easy way to add inner shadow to composables? I want a small simple shadow INSIDE my Column. I looked up other answers in this server and I couldnt make the suggestions work and was wondering if there is a new/better method available now.
    a
    • 2
    • 8
  • c

    Colton Idle

    02/23/2022, 7:58 PM
    Compose Version 1.2.0-alpha04 out today 😛arty-parrot: Here are some release notes and git commits I found interesting: • "Hooray! Compose animation now supports 'Animator duration scale' setting from Developer Options. (I31c24, b/161675988)" • Support async font loading in Text (I77057, b/214587005) •
    LazyVerticalGrid
     now supports reverseLayout. (I6d7d7, b/215572963, b/211753558) • Add 
    WindowInsets.only()
     method to allow developers to include only dimensions from the WindowInsets. (I14c94, b/217768486) • Added 
    ComposableTarget
    , 
    ComposableTargetMarker
     and 
    ComposableOpenTarget
     that allows compile time reporting of when a composable function is called targeting an applier it was not designed to use. (I don't understand this one but seems important) • Add support for filter chips (I39a6e, b/192585545) (I think this means the little chip components are back! Nice!) • Provided a way to adjust horizontal and vertical paddings in text fields. (OHHHHH YEAHHHH. This question comes up in this slack like once a week. Nice to have an answer to it) • Added 
    TextFieldDecorationBox
     and 
    OutlinedTextFieldDecorationBox
    . Using them together with 
    BasicTextField
     will help you build custom text field based on Material Design text fields but with more options for customisation. (same as above. more customization) • Adds Material 3 bottom app bar support (Ic432a) • Some navigation drawer fixes/changes
    🙌 13
    :party-parrot: 3
    👍 2
    c
    • 2
    • 1
Powered by Linen
Title
c

Colton Idle

02/23/2022, 7:58 PM
Compose Version 1.2.0-alpha04 out today 😛arty-parrot: Here are some release notes and git commits I found interesting: • "Hooray! Compose animation now supports 'Animator duration scale' setting from Developer Options. (I31c24, b/161675988)" • Support async font loading in Text (I77057, b/214587005) •
LazyVerticalGrid
 now supports reverseLayout. (I6d7d7, b/215572963, b/211753558) • Add 
WindowInsets.only()
 method to allow developers to include only dimensions from the WindowInsets. (I14c94, b/217768486) • Added 
ComposableTarget
, 
ComposableTargetMarker
 and 
ComposableOpenTarget
 that allows compile time reporting of when a composable function is called targeting an applier it was not designed to use. (I don't understand this one but seems important) • Add support for filter chips (I39a6e, b/192585545) (I think this means the little chip components are back! Nice!) • Provided a way to adjust horizontal and vertical paddings in text fields. (OHHHHH YEAHHHH. This question comes up in this slack like once a week. Nice to have an answer to it) • Added 
TextFieldDecorationBox
 and 
OutlinedTextFieldDecorationBox
. Using them together with 
BasicTextField
 will help you build custom text field based on Material Design text fields but with more options for customisation. (same as above. more customization) • Adds Material 3 bottom app bar support (Ic432a) • Some navigation drawer fixes/changes
🙌 13
:party-parrot: 3
👍 2
c

Chuck Jazdzewski [G]

02/23/2022, 10:32 PM
Added 
ComposableTarget
, 
ComposableTargetMarker
 and 
ComposableOpenTarget
 that allows compile time reporting of when a composable function is called targeting an applier it was not designed to use. (I don't understand this one but seems important)
These are inferred by the compiler plugin and allow detecting when an
@Composable
function is being used to target an applier that it wasn't designed for. For example, it can be used to prevent a Compose UI composable from being used in the context of a Compose for Web applications or vis versa.
👍 1
🎉 7
View count: 3