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

    Jason Inbody

    08/06/2021, 3:15 AM
    public void onBraintreeSubmit(View v) {
      DropInRequest dropInRequest = new DropInRequest()
        .tokenizationKey("sandbox_************");
      startActivityForResult(dropInRequest.getIntent(this), REQUEST_CODE);
    }
    ➕ 1
    a
    • 2
    • 11
  • j

    Jason Inbody

    08/06/2021, 4:57 AM
    How do I read data from an
    rememberLauncherForActivityResult
    ?
    • 1
    • 3
  • p

    PHondogo

    08/06/2021, 8:28 AM
    Does MutableState.value supposed to be assigned only in UI thread?
    🇳🇴 3
    z
    • 2
    • 1
  • c

    CLOVIS

    08/06/2021, 10:26 AM
    React doesn't allow to use hooks conditionally (differently each render):
    val Component = fc<RProps> {
    if (…)
    useRef() // big no no
    }
    Is that an issue Compose shares? Or is this safe?
    @Composable
    fun Component() {
    if (…)
    val a by remember { … }
    }
    a
    o
    • 3
    • 5
  • m

    myanmarking

    08/06/2021, 10:37 AM
    what is this error 😛 The compose compiler plugin you are using (version 1.0.1) expects a minimum runtime version of 1.0.1
    k
    • 2
    • 1
  • c

    curtjrees

    08/06/2021, 10:46 AM
    How would be the best/ideal way to use the width of a Composable while inside a LazyList? Use case is to get the width of a Image so it can be used to provide a width for the image url to be the correct size But anything with SubcomposeLayout won’t work in a LazyList, right?
    a
    • 2
    • 1
  • f

    Florian

    08/06/2021, 10:57 AM
    Is there an easy way to animate the Checkbox checked-state in Compose so it doesn't look so abrupt?
    t
    z
    +2
    • 5
    • 14
  • j

    Jan Skrasek

    08/06/2021, 11:02 AM
    How can I make Box() (or anything else) scrollable in both directions? Using
    .verticalScroll(rememberScrollState())
    .horizontalScroll(rememberScrollState())
    makes it scrollable just one direction at a time.
    👀 2
    k
    z
    d
    • 4
    • 4
  • n

    Nacho Ruiz Martin

    08/06/2021, 11:07 AM
    Hello 👋 I’ve been reading some articles about navigation component with compose, such as the one from Joe Birch about modular navigation and the one from Jossi Wolf. Both are pretty great and solve the problem quite good. Still, I have some doubts about how to reuse screens or screen flows in this kid of approaches. Does it make sense to duplicate the screens that you want to reuse in the nav graph with different routes to have different navigation callbacks? For example, you have an account modification screen that you want to use both in sign up and in the account section of the app.
    k
    j
    • 3
    • 11
  • t

    Tiago Nunes

    08/06/2021, 2:12 PM
    Hey everyone, when using coil, the images aren’t being cropped properly the first time they’re loaded, when using a placeholder. But when they’re cached it works fine… Here’s the code:
    Surface(
        shape = MaterialTheme.shapes.medium,
        modifier = Modifier
            .clip(MaterialTheme.shapes.medium)
            .size(imageSize),
    ) {
        Image(
            painter = rememberImagePainter(
                                    data = imageUrl,
                                    builder = {
                                        crossfade(true)
                                        error(R.drawable.ic_box)
                                        placeholder(R.drawable.ic_box)
                                    },
                                ),
            contentDescription = null,
            contentScale = ContentScale.Crop,
            modifier = Modifier
                .fillMaxSize(),
        )
    }
    c
    • 2
    • 1
  • a

    Azam Khan

    08/06/2021, 3:28 PM
    I have a common scaffold where I only show top app bar and bottom app bar if the current screen is a bottom nav screen. I'm trying to add sliding transition to a Search screen which has its own Scaffold. The problem is, when I navigate to my Search screen from one of my bottom nav screens, the top bar and bottom bar are immediately hidden before the slide in animation of the Search screen completes, giving a bad UX. I think it can be fixed by moving the common scaffold inside each
    composable
    of the bottom nav screens but I'm not sure if my bottom nav animations will work after that. Is there any other way to fix this? Code in thread 🧵
    i
    d
    +2
    • 5
    • 7
  • f

    Florian

    08/06/2021, 3:44 PM
    I've googled it but it's still not clear to me if we should send Parcelables between screens in Compose or not. I am in a situation where I would like to send a sealed class for a result back.
    a
    g
    +2
    • 5
    • 9
  • j

    Jordan Carlyon

    08/06/2021, 3:45 PM
    Hello, has anyone else experienced this nested scrolling error when trying to persist scroll state?
    java.lang.IllegalStateException: Nesting scrollable in the same direction layouts like ScrollableContainer and LazyColumn is not allowed.
    I have a
    LazyColumn
    in a
    Fragment
    with a
    LinearLayout
    This all works fine until I attempt to add
    .verticalScroll(rememberScrollState())
    to the
    LazyColumn
    and I get the above error
    a
    m
    • 3
    • 7
  • a

    Anthony

    08/06/2021, 3:56 PM
    Is it ok to have a nested
    NavGraph
    architecture? For example, we have a outer
    Navgraph
    for an onboarding process which then leads down into a main screen which houses bottom navigation with it's own
    Navhost
    . Or would it be recommended to have one
    Navgraph
    and to simply show the bottom navigation bar when the screens using it are displayed to the user?
    c
    i
    n
    • 4
    • 8
  • j

    Jzach

    08/06/2021, 4:11 PM
    I'm creating a theme and set colors. I have different colors for onSecondary, onBackground/onSurface. There is an error for conflicting 'on' color for background. I don't understand when onSecondary would conflict with these, and why they are different values. Can anyone help me understand if I'm doing something wrong here?
    l
    • 2
    • 11
  • i

    Ink

    08/06/2021, 4:19 PM
    How I can align two elements like that in Row()?
    a
    a
    • 3
    • 6
  • f

    Florian

    08/06/2021, 4:36 PM
    Is this how snackbars are supposed to be positioned when there is a FloatingActionButton? I know that the FAB shouldn't move up but wouldn't it look better to have the Snackbar overlap the FAB?
    i
    • 2
    • 4
  • a

    Artem

    08/06/2021, 4:44 PM
    Is it possible to change background of ComposeView? I want to add
    BottomSheetScaffold
    to already existed XML layout, but it overlay all my views with white background. Pictures in thread.
    b
    j
    • 3
    • 15
  • t

    Tash

    08/06/2021, 5:26 PM
    When building a custom design system component library in Compose, is the best approach to go one level below the Material Theme components' level of abstraction? So, for Button, go one layer down to Surface, etc.?
    z
    • 2
    • 2
  • j

    Jason Inbody

    08/06/2021, 5:59 PM
    I'm trying to find example code for bottom navigation drawers (https://material.io/components/navigation-drawer/android#bottom-navigation-drawer) in compose but can't seem to find much on this topic.
    c
    j
    • 3
    • 5
  • j

    Joey

    08/06/2021, 6:15 PM
    I noticed with NavHost (using 2.4.0-alpha06) that if I create a PendingIntent.getActivity on an activity with a data URI, for some reason it creates an activity twice when launching from the background with no currenty activity open. The first of them will even be destroyed instantly (or perhaps one activity launches the other one for some reason?). Once I remove the NavHost from my compose setup this no longer happens. Is this intended behavior? Or am I doing something wrong? Also, this setup doesn't appear to handle onNewIntent. How could I fix this?
    c
    • 2
    • 18
  • c

    Chris Fillmore

    08/06/2021, 6:44 PM
    I know it’s only a few days old, but is anyone aware of practical examples of
    accompanist-navigation-material
    in action?
    c
    c
    +2
    • 5
    • 9
  • t

    tad

    08/06/2021, 6:58 PM
    I'm looking for a way to implement a
    rememberNotNull
    function that doesn't recalculate its value when passed a null key. Can someone point me in the right direction?
    d
    • 2
    • 3
  • a

    Anthony

    08/06/2021, 7:07 PM
    When creating an edit screen for an object, would it be best practice to have each modifiable property in it's own
    by remember {mutableStateof(")}
    and when the user clicks save, all the fields are passed into an object which is saved back into the database. Or would it be better to simply edit the object in the viewmodel on every single change that occurs to it and have the UI observe it?
    s
    • 2
    • 1
  • c

    Chuck Stein

    08/06/2021, 7:11 PM
    Is there any update on bringing SafeArgs to Navigation Compose? Would love to have type safety for arguments when navigating to a composable
    j
    i
    • 3
    • 16
  • c

    Chris Fillmore

    08/06/2021, 9:19 PM
    I have filed a bug with Accompanist re: navigation-material https://github.com/google/accompanist/issues/617
    i
    j
    • 3
    • 8
  • h

    Harsh Bhakta

    08/06/2021, 10:32 PM
    Can not use theme color in Canvas DrawScope. Default colors works just fine. Here are screens of both cases. Am I missing something?
    d
    z
    • 3
    • 6
  • c

    Colton Idle

    08/06/2021, 11:31 PM
    My design system is calling for 3 types of input fields. 1. Plain text. You can enter anything 2. Email field. The input field should do basic validation to make sure it's an email (include @ sign, etc) 3. Phone number field. The input field should "validate" that it's a phone number (requires numbers, etc) I don't want to get into the topic of what is/isn't a valid phone/email. The topic to discuss is whether or not to bake these validation INTO the composable themselves. So we have something like this.
    Column{
    BasicInput()
    EmailInput()
    PhoneInput()
    }
    A few team members have argued that the validation shouldn't be baked into a composable, so we originally were doing all checks in a ViewModel and not in the composable, but the issue is, someone builds a new screen, the add EmailInput() but forgets to add the validation in the VM for the new screen and now we're back at square 1. What would you do?
    h
    t
    e
    • 4
    • 6
  • a

    Alexander Black

    08/06/2021, 11:42 PM
    Is there any way to change the default size of a RadioButton() ? They look absolutely enormous.
    c
    a
    +2
    • 5
    • 27
  • m

    Mohamed Ibrahim

    08/07/2021, 1:20 AM
    how can I show composable over a bottom navigation? overlay I think
    c
    i
    • 3
    • 2
Powered by Linen
Title
m

Mohamed Ibrahim

08/07/2021, 1:20 AM
how can I show composable over a bottom navigation? overlay I think
c

Colton Idle

08/07/2021, 2:43 AM
Have any code to show? Showing a composable over top another composable can just be done via a Box{ FirstThing(Modifier.fillMaxSize) SecondThing(Modifier.fillMaxSize) } If you mean that you just want a modal, then read up on dialogs https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:compose/[…]/samples/DialogSample.kt;l=29?q=compose%20dialog%20sample&amp;sq=
i

Ian Lake

08/07/2021, 2:44 AM
All
composable
destinations within a
NavHost
are contained within that
NavHost
. If you want to hide the bottom nav on certain destinations, we've talked about that a number of times: https://kotlinlang.slack.com/archives/CJLTWPH7S/p1627490432392100?thread_ts=1627477759.324500&amp;cid=CJLTWPH7S
☝️ 1
👀 1
View count: 2