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

    Brian Donovan

    12/03/2021, 12:57 PM
    Hello, can I get some help on why the whole "Password" word is not showing? Thanks.
    a
    t
    • 3
    • 3
  • v

    voben

    12/03/2021, 1:26 PM
    How do I add elevation to a
    TextField
    since it doesn’t have an elevation param?
    t
    b
    • 3
    • 3
  • r

    Rick Regan

    12/03/2021, 3:49 PM
    I want to remember scroll state across configuration changes within a Text with modifier
    .verticalScroll(scrollState)
    . •
    val scrollState = rememberScrollState()
    does not survive a configuration change. •
    val scrollState = rememberSaveable { ScrollState(0) }
    gets an exception "ScrollState@fb46372 cannot be saved using the current SaveableStateRegistry". •
    val scrollState = ScrollState(0)
    globally outside of any Composable works, but this is putting the scroll state outside the scope of the Composable. Is it OK to do that? Is there another way?
    i
    • 2
    • 11
  • b

    Brian Donovan

    12/03/2021, 4:42 PM
    Hello all, can I get some help with this? Am I missing some dependencies? Thanks
    m
    • 2
    • 2
  • c

    Colton Idle

    12/03/2021, 4:45 PM
    Related to compose navigation. I have a dialog destination, but can't find docs on how to close the dialog, or prevent the dialog from being closed from an outside touch. Is my google-fu just bad? Edit: I suppose to close the dialog I just call popBackStack()? My question of customizing the dialog still remains though. Cheers
    i
    • 2
    • 3
  • c

    Colton Idle

    12/03/2021, 4:51 PM
    Question about snackbars. If I have a root level Scaffold, and each of my screens also uses a scaffold... I'm starting to think I should send all snackbars to the root level scaffold. Maybe there's no right/wrong way to do this, but I guess thinking of snackbars as like an app level notification (like a toast), then just punting to the root kinda sorta makes sense?
    n
    a
    • 3
    • 10
  • r

    robnik

    12/03/2021, 5:51 PM
    Is there a web page where I can see the latest version number for Compose?
    j
    c
    • 3
    • 2
  • j

    Joseph Hawkes-Cates

    12/03/2021, 6:09 PM
    Quick question on NavGraphBuilder. I tried to google and search in here, but not having luck finding an answer. Does the order that you add your composables to the graph matter or impact anything?
    i
    • 2
    • 2
  • i

    Istvan Beri

    12/03/2021, 7:03 PM
    Hy Everyone! I'm using Coil 1.4.0 to load an image in the following example:
    @Composable
    fun TestScreen() {
        Column(
            modifier = Modifier
                .fillMaxSize(),
            horizontalAlignment = Alignment.CenterHorizontally
        ) {
            Image(
                painter = rememberImagePainter("<https://cdn.vox-cdn.com/uploads/chorus_image/image/47684009/Screenshot_2014-07-19_15.24.57.0.png>"),
                contentDescription = null,
                modifier = Modifier
                    .fillMaxHeight(0.4f)
            )
            Button(onClick = { }) { }
        }
    }
    If I add a
    .verticalScroll(rememberScrollState())
    modifier to the
    Column
    the image doesn't show up anymore, only the button. What am I doing wrong or what do I miss?
    t
    • 2
    • 3
  • b

    brabo-hi

    12/03/2021, 7:33 PM
    Hi all, when navigating from what is the difference between
    navController.navigate("nextPage") {
        popUpTo("currentPage") { inclusive = true }
    }
    
    //and 
    navController.navigateUp()
    navController.navigate("nextPage")
    i
    • 2
    • 5
  • t

    Tolriq

    12/03/2021, 8:31 PM
    Is there a way to have some kind of zIndex working outside of a single parent or some way to handle priority for clickable when there's overlap ?
    g
    d
    • 3
    • 7
  • j

    Jesse Hill

    12/04/2021, 1:37 AM
    I was trying to make a keyboard avoiding TextField and found an unexpected (at least unexpected to me) behavior when I combined it with a Scaffold. I was thinking that if I scrolled the Column within the content of the Scaffold that the TopBar would stay in place but what I ended up with was the TopBar scrolls out of view which makes me think the whole Scaffold is scrolling and not just the Column that has the
    verticalScroll
    modifier. I put the code in this gist and will comment with my findings as I explore why this is happening.
    Screen Recording 2021-12-03 at 7.36.19 PM.mov
    c
    • 2
    • 4
  • s

    spierce7

    12/04/2021, 3:23 AM
    I’ve been looking at Molecule for use with Compose. It’s intriguing the idea that’s being proposed. Effectively, it seems like it boils down to Presenter as a function. What are the benefits that this enables me to take advantage of that I didn’t have access to before? I’m curious as to peoples thoughts, and am looking for opinionated answers.
    z
    c
    a
    • 4
    • 5
  • s

    spierce7

    12/04/2021, 4:52 AM
    What’s the best way to make a Compose Table? If LazyColumn is the best way provided in the standard compose library, is there a 3rd party library anyone can recommend?
    👀 1
    m
    • 2
    • 1
  • f

    Florian

    12/04/2021, 8:30 AM
    If I wanna use a custom font, do I need to override each and every style in this file or is there a way to change the Default font for all of them at once?
    • 1
    • 1
  • y

    YASAN

    12/04/2021, 1:33 PM
    I use
    compose-navigation
    . I have a relatively heavy video player route which can be opened from a few other routes. Is there a way to always keep that route open in the background so it doesn't have to initialize every time? I just want to change the
    videoId
    used in the route every time its opened.
    ➕ 1
    👋 1
    i
    c
    • 3
    • 5
  • z

    Zun

    12/04/2021, 2:04 PM
    Not sure if a question or vent but how do you guys feel about the magic that happens with NavHost and ViewModels SavedStateHandle? This is the first time in Kotlin where I see arguments being magically passed. See screenshot. Is there an alternative method of passing down an argument to VM so I can use them in the
    init
    ?
    s
    i
    • 3
    • 10
  • c

    Colton Idle

    12/05/2021, 12:57 AM
    My designer is asking to center this vertically. It looks as though I am, but when she screenshots it and does measurements based off of the T, the T is closer to the bottom vs the top. On iOS that team was able to get them perfectly centered. (I have to admit the chips do look better on iOS) Code in thread. What am I doing wrong?
    👀 1
    😞 1
    d
    z
    +6
    • 9
    • 40
  • y

    yschimke

    12/05/2021, 10:20 AM
    Is smart cast for nullable State fields something that could be improved in Compose? Seems like a case for https://youtrack.jetbrains.com/issue/KT-20294, The composition should run within a snapshot of the state system, where a field is null or not. Seems like the taskSeries should be known to be non-null.
    val taskSeries by viewModel.taskSeries(taskSeriesId).collectAsState(initial = null)
    
        if (taskSeries != null) {
                    Text(text = taskSeries.name)
    d
    s
    • 3
    • 5
  • y

    yschimke

    12/05/2021, 10:20 AM
    Or what do people do to get around this, apart from !!
    a
    • 2
    • 1
  • s

    Sher Sanginov

    12/05/2021, 6:55 PM
    Hi Compose team, I have a documentation request. Can you add 
    Thinking in Compose
     documentation similar to 
    Thinking in React
     and show an entire process of building some feature using Compose? Here's the React one for reference: https://reactjs.org/docs/thinking-in-react.html I found React documentation very useful because: 1. It shows how to break your UI into several components (or Composables) 2. Identify The Minimal (but complete) Representation Of UI State 3. Explains where state should live (concept of state hoisting in Compose) 4. Explains inverse data flow There is already 
    Thinking in compose
     documentation (https://developer.android.com/jetpack/compose/mental-model) out there but it explains the concepts with small examples unlike React's full-screen searchable product data table example. Thank you
    👍 5
    ➕ 2
    b
    z
    v
    • 4
    • 8
  • h

    Humphrey

    12/05/2021, 8:34 PM
    What should be used to couple some composables together? If you have a text field and two buttons, and you want those to expand full ColumnRow when the screen resizes. I'm working on a Desktop application and when you resize the window, would like it still to show correctly. What I'm also looking for is to set a minimum width and height for resizing of the window.
    • 1
    • 1
  • r

    rsktash

    12/05/2021, 11:27 PM
    Demonstration of Compose TextField capabilities
    2_5289878474205434226.mp4
    👀 3
    s
    • 2
    • 4
  • r

    Rafiul Islam

    12/06/2021, 8:19 AM
    I was trying to follow this video for my login flow.

    https://www.youtube.com/watch?v=09qjn706ITA&amp;t=285s&amp;ab_channel=AndroidDevelopersfor▾

    But I am facing a problem. Details in the thread.
    ➕ 1
    • 1
    • 1
  • k

    K Merle

    12/06/2021, 9:01 AM
    What is the recommended way to handle common strings and dimensions? Should we store them inside .xml or should we have them as global variables?
    s
    y
    k
    • 4
    • 4
  • s

    ste

    12/06/2021, 9:31 AM
    This is probably gonna be controversial, but anyway... Am I the only one who doesn't feel comfortable with
    navigation-compose
    ? I feel like it clashes with "thinking in compose" mindset; are there third-party alternatives?
    👍 1
    😀 4
    💯 5
    s
    m
    +2
    • 5
    • 11
  • p

    Pavle Joksovic

    12/06/2021, 1:17 PM
    Hey I have a noob question, I have two Composables inside a Row, and I want to align one to the left and one to the right. What's the easiest way to do this?
    c
    f
    • 3
    • 2
  • f

    Florian

    12/06/2021, 2:13 PM
    do these still play a role with Compose and min API 21?
    a
    f
    c
    • 4
    • 5
  • m

    Mateusz Apacki

    12/06/2021, 2:20 PM
    Hey it is possible to restore WebView state in Compose? Thread 🧵
    • 1
    • 2
  • t

    Tolriq

    12/06/2021, 3:21 PM
    What is the proper way to have a root BackHandler that have priority over the inner components (Typically a modalbottomsheet should intercept the backpress and not let an inner composable handle it before it's dismissed)
    i
    • 2
    • 4
Powered by Linen
Title
t

Tolriq

12/06/2021, 3:21 PM
What is the proper way to have a root BackHandler that have priority over the inner components (Typically a modalbottomsheet should intercept the backpress and not let an inner composable handle it before it's dismissed)
i

Ian Lake

12/06/2021, 3:47 PM
There are two ways to use BackHandler - unconditionally (which means that lower level handlers are triggered before the higher level handlers) or conditionally (i.e., only adding the BackHandler if your bottom sheet is showing, this ensuring that it is the last one registered)
It sounds like you want the later, which is indeed appropriate for 'overlay' style components
Of course, if you are using Accompanist Navigation Material and its support for bottom sheets, then you'll get the right back behavior by default, no work required
t

Tolriq

12/06/2021, 3:50 PM
Arf thanks for the pointer I was looking at the wrong point. I'm using another library that uses enabled = sheetState.isVisible, instead of the if test, so it's added first and not last. I'll open a PR to fix that library. Thanks again for the eye opener about order of calls and not as the deepness of the compose hierarchy.
View count: 2