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

    sergio felipe de jesus gomes

    01/05/2022, 2:29 PM
    Hey everybody! Any reason why this happen? Basically when using BottomAppBar or TopAppBar even if I specify background color seems like some kind of alpha is added and I dont know how can I remove that (image on the left). When replacing Topappbar with surface the color is actually the expected (image on the right).
    a
    • 2
    • 2
  • m

    mattinger

    01/05/2022, 4:13 PM
    So, if i have a ViewModel with a MutableState object, how can i get that tied to a SavedStateHandle? I was consdering manually doing this with a snapshotFlow and having the viewmodel start a coroutine to monitor it and write it to the savedStateHandle. But this seems like a ton of boilerplace for something that LiveData gets out of the box. See thread for code.
    a
    k
    i
    • 4
    • 33
  • s

    spierce7

    01/05/2022, 4:32 PM
    I’m making an app in compose - and the designs use these shadows in many places, where they surround the outside of the component and then fade. What is the best way to achieve this in Compose?
    r
    j
    • 3
    • 8
  • n

    Nat Strangerweather

    01/05/2022, 5:04 PM
    Does passing arguments with Compose Navigation have an effect on performance? I have quite a few Strings to pass, but I might be able to find a solution to avoid it if needed. If it has no effect on performance, I'll take the easy route (no pun intended). 🤔
    m
    r
    +3
    • 6
    • 51
  • b

    Brian Donovan

    01/05/2022, 5:40 PM
    Hey all, I am calling a composable with lazy column inside of another compsable (homescreen) and getting this error. The problem I am running into is that I can’t have a vertical scrollState with a lazy column? What would be this fix?
    java.lang.IllegalStateException: Vertically scrollable component was measured with an infinity maximum height constraints, which is disallowed. One of the common reasons is nesting layouts like LazyColumn and Column(Modifier.verticalScroll()). If you want to add a header before the list of items please add a header as a separate item() before the main items() inside the LazyColumn scope. There are could be other reasons for this to happen: your ComposeView was added into a LinearLayout with some weight, you applied Modifier.wrapContentSize(unbounded = true) or wrote a custom layout. Please try to remove the source of infinite constraints in the hierarchy above the scrolling container.
    how to put a LazyColumn inside Column(Modifier.verticalScroll())
    a
    a
    +2
    • 5
    • 19
  • y

    YASAN

    01/05/2022, 6:42 PM
    Is it possible to keep X number of a route in back stack and pop the oldest one once it reaches the limit?
    i
    o
    • 3
    • 9
  • c

    Chris Johnson

    01/05/2022, 8:35 PM
    Hello everyone :android-wave: . I've been playing with
    SwipeToDismiss
    and
    swipeable/draggable
    and was wondering if there's a configuration I'm missing to completely disallow swiping in a certain direction? Currently I see we have in
    swipeable
    a resistanceConfig that you can define. This would make it hard to swipe on a certain side, but not impossible.
    r
    • 2
    • 3
  • f

    Filip Wiesner

    01/06/2022, 7:32 AM
    Weird question. Is
    remember { ... }
    equal to
    remember(Unit) { ... }
    ? Or does the
    Unit
    key override the implicit key derived from call order? Am I just overthinking things?
    :yes: 2
    👀 1
    f
    c
    • 3
    • 6
  • p

    Paul Woitaschek

    01/06/2022, 7:40 AM
    What’s the difference between these two? androidx.compose.compiler:compiler androidx.compose:compose-compiler
    👀 2
    a
    k
    • 3
    • 2
  • y

    Yves Kalume

    01/06/2022, 9:58 AM
    what is the best way to display a pdf with jetpack compose ?
    g
    b
    a
    • 4
    • 8
  • m

    myanmarking

    01/06/2022, 10:17 AM
    I need to build a LazyRow with each item width be a percentage of the parent. Something like: ItemWidth = parentWidth/x. How can i get access to parentWidth and try to accomplish this? Any advice
    t
    z
    • 3
    • 3
  • m

    myanmarking

    01/06/2022, 12:35 PM
    if i want to change some color based on list scrolling or not, is this the correct approach:
    var isScrolling by remember {
            mutableStateOf(lazyListState.isScrollInProgress)
        }
        
        LaunchedEffect(key1 = lazyListState){
            snapshotFlow { lazyListState.isScrollInProgress }.collect {
                isScrolling = it
            }
        }
    a
    • 2
    • 13
  • a

    AmrJyniat

    01/06/2022, 4:10 PM
    Hi there, here is my first real app with compose, glad to hear your feedback! https://github.com/Amrjyniat/FullMangement
    👍 2
    r
    • 2
    • 2
  • n

    Nick

    01/06/2022, 5:06 PM
    Is there a blog/twitter/anything I can follow to see compose specific libraries/projects that the community has created? There’s a couple github projects that curate a list but they aren’t up to date and lack some cool projects.
    c
    b
    • 3
    • 4
  • s

    Slackbot

    01/06/2022, 5:19 PM
    This message was deleted.
    m
    • 2
    • 1
  • m

    myanmarking

    01/06/2022, 9:55 PM
    is there any specific channel for compose code review?
    a
    • 2
    • 1
  • s

    Stylianos Gakis

    01/07/2022, 6:17 AM
    Is there a way to remember things across configuration changes without AAC VM? My specific use case is that I am using a MediaPlayer inside a class that I am now `remember`ing that I would like to persist when the user selects dark mode for example. But putting that inside a rememberSaveable seems a bit tricky, since I can’t persist its internal state because rememberSaveable will try to re-create it even after process death. Is ViewModel my only solution here for this use case of “persist it across config changes, but not across process death”?
    a
    • 2
    • 8
  • n

    Napa Ram

    01/07/2022, 7:21 AM
    Hi, i am creating app in compose and designer give me UI with 4 tab and inside every tab in need to show list and it should be searchable with any of column, So my problem is there are around 500 record on every tab so whenever user click on tab api should get called and fetch data from server and always show first 10 record at a time and then add navigation like move to next page it should next record if he click on last page then it should move to last 10 record i Attached UI for reference Btw i am creatiing UI for tablet Thanks in advance for help
    👎 2
    b
    c
    • 3
    • 4
  • s

    Sebastian Kürten

    01/07/2022, 8:36 AM
    In our (compose for desktop based) project we're using a lot of
    mutableStateOf()
    and a background thread for potentially longer running tasks that deliver data and alter state variables. Naturally, sometimes buttons etc. also write to such state variables. Now we're wondering about thread safety and what kind of synchronization mechanisms we might need. I realize the state handling and snapshots do a lot of heavy lifting for us, but it would be really nice to read some documentation about that. I find next to nothing on that topic in the compose docs: https://developer.android.com/jetpack/compose/documentation We have found Zach's series "Compose state explained" https://dev.to/zachklipp/series/12895 and the articles there are very insightful. Still I'm wondering if there might be other "official" resources such as docs or references on those topics that we might have missed?
    ➕ 1
    z
    a
    • 3
    • 5
  • r

    rocketraman

    01/07/2022, 9:13 AM
    Is this a compose compiler bug? Using #compose-web, this inside a composable does the expected thing:
    @Composable
    fun ElementScope<HTMLElement>.BlockChildLink(
      span: BlockChildSpan,
      markDefs: List<MarkDef>,
      content: @Composable ElementScope<HTMLElement>.() -> Unit
    ) {
      val link = span.marks.linkOrNull(markDefs)
      if (link != null) {
        A(href = link.href) {
          content()
        }
      } else content()
    }
    but this always results in empty content if the link is null i.e. the
    content()
    to the right of the elvis operator is ignored:
    @Composable
    fun ElementScope<HTMLElement>.BlockChildLink(
      span: BlockChildSpan,
      markDefs: List<MarkDef>,
      content: @Composable ElementScope<HTMLElement>.() -> Unit
    ) {
      span.marks.linkOrNull(markDefs)?.let { link ->
        A(href = link.href) {
          content()
        }
      } ?: content()
    }
    e
    • 2
    • 1
  • m

    myanmarking

    01/07/2022, 9:27 AM
    is there a better way to do this? Some items are disabled so they wont need click:
    .then(if (isEnabled) Modifier.clickable { onItemClicked(index) } else Modifier)
    f
    b
    z
    • 4
    • 3
  • s

    Stylianos Gakis

    01/07/2022, 9:28 AM
    Regarding this comment, if this is something that is safe to do, could we get some explanation/details about it on the official documentation? I haven’t found anything on the official docs but it seems like it’s a pretty interesting difference that we can take advantage of if we’re compose-first Activities.
    ➕ 2
    🤔 1
    👀 1
    z
    t
    +4
    • 7
    • 13
  • b

    Bassam A.

    01/07/2022, 10:34 AM
    how can I make an activity scrollable in compose?
    v
    s
    • 3
    • 10
  • m

    myanmarking

    01/07/2022, 11:21 AM
    I have a problem i need an advice on. I used to have brand colors like R.brand.blue that had two variantes, for light and dark mode. The resource system resolved them. With compose, i create brand colors like
    val MaterialTheme.brandColor: BrandColor
        @Composable
        @ReadOnlyComposable
        get() = LocalBrandColor.current
    and injected into the theme with CompositionLocalProvider. So in a composable, i can do MaterialTheme.brandColor.blue and it will resolve for light and dark. My problem: I used to resolve this colors in the viewMode, like using R.brand.blue and it was fine. In compose, i cannot do that, because it required a composable context. What can i do ?
    m
    c
    • 3
    • 4
  • t

    Tolriq

    01/07/2022, 3:19 PM
    Got a small issue with TextField and keyboard overlap. When I click on TextField the content is properly moved above the keyboard. But if if I use imeAction = ImeAction.Next to move to that TextField the content is not moved and stay under the keyboard. Is there some trick to fix this ?
    z
    m
    c
    • 4
    • 11
  • l

    loloof64

    01/07/2022, 4:10 PM
    Hi everybody ! Given this
    LazyColumn
    , how can I know if an item has been Long-clicked, and its index ?
    Untitled.kt
    z
    • 2
    • 7
  • n

    Neil

    01/07/2022, 4:58 PM
    Hi all, I want to test that my composables look correct so I want to check colour, spacing, font size etc. I’ve seen some references in the compose source code to Screenshot tests that use AndroidXScreenshotTestRule. Can’t find much information on this though. Does anyone know anything about these tests, like what dependencies are needed and how to set them up?
    m
    • 2
    • 5
  • m

    mattinger

    01/07/2022, 6:31 PM
    Does anyone know how to tie together a Switch with a Text so that the switch announces the text as it’s focused. Best i can find is using the “contentDescription” semantic property on the switch, and that should announce it, but then the text will also get announced as it’s own thing.
    👍 1
    b
    l
    • 3
    • 2
  • s

    Slackbot

    01/07/2022, 7:04 PM
    This message was deleted.
    c
    • 2
    • 1
  • c

    Colton Idle

    01/08/2022, 1:26 AM
    Compose nav question. Is every navigation destination essentially a "global" destination? I remember with navigation arch component you would actually create actions by settings these deterministic connections between screens. Is that gone with compose nav?
    f
    • 2
    • 1
Powered by Linen
Title
c

Colton Idle

01/08/2022, 1:26 AM
Compose nav question. Is every navigation destination essentially a "global" destination? I remember with navigation arch component you would actually create actions by settings these deterministic connections between screens. Is that gone with compose nav?
f

FunkyMuse

01/08/2022, 3:06 PM
Yes it's global, I'm not sure about sub graphs tho, but basically even sub graphs are under the same nav host
View count: 3