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

    Zoltan Demant

    10/05/2021, 5:22 AM
    Is it possible to render a scrim using compose with
    AnimatedContent
    ? 🧵👀
    a
    d
    • 3
    • 14
  • i

    Ink

    10/05/2021, 6:04 AM
    Hi guys How Can I create horizontal line with circle like on the picture? My code draw only horizontal line
    m
    • 2
    • 3
  • t

    Tolriq

    10/05/2021, 8:57 AM
    Is remember supposed to work correctly in LazyColumn / item on something that is always on screen or is there some subtilty here?
    a
    • 2
    • 7
  • a

    Alex

    10/05/2021, 9:38 AM
    Suppose I am using a
    ComposeView
    to show a composable. Is there a way for the
    ComposeView
    to receive a callback when the content is recomposed?
    r
    a
    • 3
    • 10
  • a

    Alex

    10/05/2021, 10:09 AM
    Does anyone know where the source code for jetpack compose is located?
    s
    • 2
    • 1
  • c

    Chris Miller

    10/05/2021, 11:23 AM
    I have a
    LazyColumn
    that displays a
    mutableStateListOf(items)
    . There are about 100 items in the list and once populated (loaded from a server) the list doesn't change. Individual items do sometimes mutate however (by making a mutated copy of the item and replacing the previous instance of it in the list). This all works as expected. I now want to add a search/filter TextField, that reduces the items displayed to just those where
    item.name.contains(searchText)
    . I'm not sure what the best approach to implementing this is: 1. Create a new
    mutableStateListOf()
    list that contains just the filtered items, clearing and repopulating it from the full list each time the search text changes. It seems tricky to deal with mutating items using this approach though (both lists will need updating). 2. Similar to 1, but convert to a
    mutableStateOf(List<Item>)
    and create a new list (from the separate full list) each time the search text changes or an item is mutated. 3. Leave things as they are, but make the item @Composable take the search text as a parameter, and display nothing if
    contains()
    returns false. This seems easy, but also hacky. 4. Something else?
    t
    • 2
    • 3
  • b

    bodo

    10/05/2021, 1:36 PM
    Hi. I am trying to implement a screen with multiple tabs (accompanist - pager) so i did something like this:
    @Composable
    fun Screen() {
      val screenViewModel: ScreenViewModel = hiltViewModel()
      val pages by screenViewModel.pages.collectAsState()
      val pagerState = rememberPagerState(pageCount = pages.size)
    
      HorizontalPager(state = pagerState) { index ->
        Column(modifier = Modifier.fillMaxWidth()) {
          // this viewmodel should be created with data from the page object (e.g. id)
          val pagerViewModel: PagerViewModel = hiltViewModel() // actual: same viewmodel on every page -> expected: every page get´s its own viewmodel
          ...
        }
      }
    }
    Is it possible to get a ViewModel per page via hilt or should i use a complete different approach than ViewModels in this case?
    p
    • 2
    • 1
  • s

    Sergey Y.

    10/05/2021, 1:37 PM
    Oooh, I wish we had this API as well on Android.
    New public API: androidx.compose.ui.renderComposeScene - renders UI into an image
    1839133: Desktop. WithComposeScene, deprecate TestComposeWindow | https://android-review.googlesource.com/c/platform/frameworks/support/+/1839133
    ➕ 9
    c
    a
    +2
    • 5
    • 8
  • b

    Brian G

    10/05/2021, 7:51 PM
    Is there any compose equivalent to
    addOnLayoutChangeListener
    ? Specifically, I'd like to know what x/y/width/height was chosen for a given composable.
    m
    • 2
    • 3
  • f

    Florian

    10/05/2021, 8:03 PM
    In what situations would
    LocalContext.current
    be of type
    ContextWrapper
    rather than
    Activity
    ?
    z
    i
    c
    • 4
    • 4
  • s

    saket

    10/05/2021, 10:11 PM
    After adding an
    AbstractComposeView
    to our app, I’m noticing that my states aren’t getting saved (using
    rememberSaveable
    ) when the view is detached from window. I’m trying to investigate this for some time but I haven’t reached anywhere. How can I investigate what might be happening?
    a
    i
    z
    • 4
    • 19
  • f

    Fabio

    10/05/2021, 11:03 PM
    With latest compose 1.0.3, what's the situation for kotlin 1.5.21 and accompanist v0.18.0? I know I can use 1.5.30 and 0.19.0, but do I need that? The upgrade policy in the 1.0.0 alpha/beta/rc days was that I'd need everything in lockstep, but is that still necessary? I couldn't find any release notes breaking changes, but what's the official way to do this? Side question with AGP 7.1 when it reaches stable and compose 1.1.0 stable when it goes out
    j
    • 2
    • 5
  • c

    Colton Idle

    10/05/2021, 11:37 PM
    Does anyone know how to go from the default TabRow indicator to something that only stretches for the length of the text itself? https://stackoverflow.com/questions/65581582/scrollabletabrow-indicator-width-to-match-text-inside-tab
    f
    • 2
    • 2
  • m

    ms

    10/06/2021, 4:21 AM
    When can we expect stable Animations API?
    d
    a
    • 3
    • 2
  • v

    Vipulyaara

    10/06/2021, 5:14 AM
    Hello, I need some help. Using
    IntrinsicSize
    does not wrap the content and truncates the height of the composable. Code and screenshots in thread ->
    • 1
    • 3
  • e

    Ernestas

    10/06/2021, 6:09 AM
    Hello. Anyone can point me how I can change the DropdownMenu color? Currently if I change it through
    Modifier.background()
    it looks like it just draws other shape on top of current menu container. Adding a screenshot on what I mean. Is there anything I missing? Or should I choose other option on creating DropdownMenus? 🤔
    • 1
    • 1
  • m

    Michael Bichlmeier

    10/06/2021, 8:30 AM
    Does somebody know how I can set an equivalent of
    android:background="?selectableItemBackground"
    on
    Text
    or
    ClickableText
    elements for example?
    c
    • 2
    • 1
  • s

    Stefano Sansone

    10/06/2021, 9:15 AM
    Anyone know a way to add space in
    AlertDialog()
    between title and text ?
    n
    • 2
    • 1
  • s

    Stefano Sansone

    10/06/2021, 9:15 AM
    https://stackoverflow.com/questions/69452854/increase-space-between-title-and-text-of-alertdialog-in-compose
    z
    z
    • 3
    • 8
  • t

    Tolriq

    10/06/2021, 9:24 AM
    In Compose 1.1.0-alpha05 (don't know if happens before but before fling was bugged due to lack of pointer history) when I start a fling then touch the screen the fling is stopped but the click is passed to the child making it impossible to stop fling without clicking. This is not the case with a recyclerview for example. Is there some specific parameter to manage that or should it be considered an bug ?
    a
    • 2
    • 2
  • p

    Paul Woitaschek

    10/06/2021, 9:55 AM
    What is the difference between these two?
    var a: Boolean by remember { mutableStateOf(false) }
    var b: Boolean = remember { false }
    m
    t
    +4
    • 7
    • 14
  • j

    julioromano

    10/06/2021, 3:14 PM
    Is it possible to mutate two (or more) MutableState variables in a single “transaction” ?
    ✅ 1
    z
    r
    +2
    • 5
    • 16
  • a

    andrew

    10/06/2021, 3:42 PM
    Did some more work on my side project app, feels pretty fluid, impressed with how well compose handles stuff like massive repaints, I feel 0 janks using this 😊
    21-10-06-11-40-29.mp4
    :jetpack-compose: 18
    🚀 15
    l
    c
    • 3
    • 12
  • c

    Chris Miller

    10/06/2021, 4:35 PM
    My app has a
    Scaffold
    with a
    TopAppBar
    ,
    BottomNavigation
    and the content is a
    Column
    containing a
    LazyColumn
    plus a
    TextField
    . When the onscreen keyboard is displayed, I want the
    TopAppBar
    and
    LazyColumn
    to stay where they are, the
    TextField
    to be pushed up to just above the keyboard, and the
    BottomNavigation
    to be hidden. I'm trying to achieve this with accompanist-insets-ui, but haven't been able to figure out how.
    navigationBarsWithImePadding()
    comes close, but results in extra whitespace between the TextField and the keyboard, due to the TextField not being located right at the bottom of the screen when there's no keyboard showing. Any ideas on how I can solve this?
    a
    s
    • 3
    • 16
  • a

    andrew

    10/06/2021, 6:29 PM
    Right now because the toolbar doesn't consume touches it goes to the views underneath
    z
    • 2
    • 3
  • b

    brabo-hi

    10/07/2021, 12:05 AM
    Hi, when using
    bottomSheet
    from
    accompagnist
    how can we set or control the default
    modalSheetValue
    ??
    i
    • 2
    • 3
  • m

    mattinger

    10/07/2021, 3:40 AM
    Anyone know why navigation component 2.4.0 requires compile sdk 31? I’m running into this because we’re using compile sdk 30, and i’m trying to use accompanist to do the navigation animation, which depends on 2.4.0 alpha 7 of navigation. That happens to require sdk 31. The issue is that upgrading our app with this would mean reworking a bunch of our bluetooth code to account for the new bluetooth permissions. We’ll have to do this eventually, but it does present a barrier.
    e
    i
    • 3
    • 2
  • c

    Colton Idle

    10/07/2021, 4:19 AM
    Trying to draw this fairly simple column in compose but failing. Code in thread.
    k
    a
    g
    • 4
    • 25
  • s

    slartus

    10/07/2021, 6:03 AM
    how to switch off in compose LazyColumn overscroll effect like android:overScrollMode="never" for RecyclerView ps. sorry for crossposting from wrong channel "android"
    s
    • 2
    • 2
  • k

    Kenneth Leong

    10/07/2021, 6:13 AM
    is there a way to access
    dimensionResource
    inside a
    constrainScope
    for setting constraint margins?
    c
    • 2
    • 3
Powered by Linen
Title
k

Kenneth Leong

10/07/2021, 6:13 AM
is there a way to access
dimensionResource
inside a
constrainScope
for setting constraint margins?
c

Csaba Kozák

10/07/2021, 7:15 AM
You cannot do that, since the
constrainScope
lambda is not
@Composable
. You have to save the dimens to variable in
@Composable
context, and access that in the
constraintScope
.
k

Kenneth Leong

10/07/2021, 7:18 AM
thats what i am doing now. Its not a big issue but it would be nice to be able to directly reference dimensionResource especially now when compose does not support dimension value buckets (e.g. values-sw300) yet.
c

Csaba Kozák

10/07/2021, 7:19 AM
I absolutely agree with you. Maybe it is worth to file an issue.
View count: 1