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

    ms

    04/17/2021, 2:59 AM
    I'm using
    CircularProgressIndicator
    and I want to change it's size. When using
    Modifier.size(size)
    it's getting clipped. Is there any other way to resize or is it not supported yet?
    • 1
    • 1
  • c

    Colton Idle

    04/17/2021, 3:37 AM
    Material has regular input fields and condensed input fields. How do we use condensed text input in compose material?
    s
    o
    c
    • 4
    • 10
  • s

    Shakil Karim

    04/17/2021, 11:22 AM
    I found Navigation Compose buggy when i will try to pop the whole stack but it works sometimes. I wish, there is method for clearing the complete back stack, popUpTo is very confusing
    i
    • 2
    • 4
  • r

    rocketraman

    04/17/2021, 12:17 PM
    My composable has a
    LaunchedEffect
    (that creates a toast), keying on a state variable (via
    by x.collectAsState()
    ). However, when the state is transient i.e. it changes relatively quickly from state A to state B, the
    LaunchedEffect
    is not triggered at all for either state A or B. Its a login screen and the user state transitions from a user login error to an anonymous user pretty quickly. I can make some changes to how the state is changed to avoid thus, but I'd like to understand what is going on here.
    d
    l
    a
    • 4
    • 29
  • o

    orangy

    04/17/2021, 12:36 PM
    I’ve upgraded to #compose-desktop 0.4.0-build183 and started getting this error:
    e: …/SnakeLayout.kt: (30, 42): Type inference failed. Expected type mismatch: inferred type is @Composable() (Int, T) -> Unit but (Int, T) -> Unit was expected
    Code is kinda like this:
    fun <T> SnakeLayout(…,
        content: @Composable (Int, T) -> Unit) {
        Layout(…,
            content = { items.forEachIndexed(content) } // here
        ) { … }
    }
    If I expand the call to
    items.forEachIndexed { i, t -> content(i,t) }
    it works fine. In version 0.4.0-build180 both variants worked. (posting here, because I believe it is more to do with compiler plugin than desktop lib)
    d
    a
    • 3
    • 3
  • a

    Arsen

    04/17/2021, 12:47 PM
    How to manage state for structures like "File System" (Nodes with list of themselves)?
    data class Node(
        val name: String,
        val children: List<Node>
    )
    I want to follow UDF + single source of truth. Level of depth is unknown (assume it's unlimited). How to follow immutability for updates (add/remove node) in this case if i should at all. Maybe it worth to try mutable state, but idk how to cook mutable state with compose and don't break recomposition.
    🤔 1
    d
    a
    +2
    • 5
    • 46
  • m

    Michal Klimczak

    04/17/2021, 1:03 PM
    HorizontalPager continues the fling from horizontal LazyRow. This is apparently Expected behavior but it differs from traditional android views and also feels really bad. Anyone knows how to work around it? Relevant github issue: https://github.com/google/accompanist/issues/347#event-4607690257
    c
    m
    +3
    • 6
    • 28
  • l

    loloof64

    04/17/2021, 3:49 PM
    Hi ! It seems I can't use
    WithConstraints
    any more (AS reports a syntax error and does not find an alternative, nor purpose an import). What workaround should I use ? My use case is that : • in portrait, one component must take the full client width (the application allocated width), • in landscape, the same component must take the full client height.
    a
    • 2
    • 2
  • l

    loloof64

    04/17/2021, 4:12 PM
    How can I toggle a preview in Landscape mode in Android Studio ? (I've got the latest Artic Fox)
    g
    • 2
    • 3
  • l

    loloof64

    04/17/2021, 4:58 PM
    I am trying to adapt the design of my Composable between portrait/landscape mode. But I'm always getting the landscape configuration. More in the thread.
    y
    l
    g
    • 4
    • 34
  • w

    wisdom

    04/17/2021, 5:40 PM
    Hi Kotliners, I need help on implementing this
    p
    • 2
    • 3
  • d

    dewildte

    04/17/2021, 6:43 PM
    I have a problem with the
    BottomSheetScaffold
    the bottom sheet keeps expanding. It seems like no matter what I do it just keeps popping open. Has anybody else run into this problem?
    s
    m
    • 3
    • 17
  • t

    tad

    04/17/2021, 8:25 PM
    Is there a way to use
    rememberSaveable
    with
    StateFlow<T>.collectAsState()
    ? I'd like to keep the state save/restore machinery in the composition if possible.
    a
    m
    +5
    • 8
    • 35
  • d

    dewildte

    04/17/2021, 10:23 PM
    I have 3 composables need to be laid out in a column. I need one aligned to the top. I need one aligned to the bottom. And I need one in between that takes up the rest of the available space. How would one achieve that? Perhaps the
    BoxWithConstraints()
    ?
    h
    • 2
    • 2
  • m

    ms

    04/18/2021, 5:14 AM
    Is there any way to get
    Application
    reference in a composable, just like
    LocalContext.current
    ??
    l
    • 2
    • 2
  • o

    Olivier Patry

    04/18/2021, 11:31 AM
    I try to animate a transition between current data state and previous one. I have difficulties to put everything in place in my mind to achieve the transition considering the previous state. I read https://developer.android.com/jetpack/compose/animation but it didn't help so far. I have a 4x4 grid compound of cells. I can move cells in all directions (imagine a 2048-like game). I'd like to do 3 transitions: 1. animate "slide" of tiles 2. animate "transform" of tiles (2 identical tiles are merged together creating a new one with higher value) 3. new tile appearance (one new tile appears at each move) I struggle on how to achieve this…
    d
    • 2
    • 23
  • a

    Arsen

    04/18/2021, 2:24 PM
    Seems like my slack thread gets broken with infinite "loading history". Does anyone experienced same stuff or it's problem on my side?
    😮 1
    o
    • 2
    • 3
  • s

    SrSouza

    04/18/2021, 2:54 PM
    Hi folks, I trying to embed Compose runtime in a project and I'm not getting it to recompose when a state change and updating my tree, what I'm missing? Source: https://github.com/DevSrSouza/compose-tree-test/blob/master/src/main/kotlin/Test.kt
    a
    • 2
    • 4
  • a

    Alejo

    04/18/2021, 4:01 PM
    Hi everyone! I'm working in a composable that receives an hour in Unix, UTC ( a Long value like 1608124431 ). I want to check if the next hour the composable receives is before or after the current hour displayed. How could I achieve this? My first approach was trying to remember the last hour but I missed up on how to access the last hour displayed...
    a
    • 2
    • 3
  • y

    YASAN

    04/18/2021, 4:33 PM
    Is it possible to make the height of all items in one LazyVerticalGrid row match the largest ones?
    d
    t
    • 3
    • 8
  • j

    Jan Skrasek

    04/18/2021, 8:17 PM
    Is there a way to add padding to composable content's (direct) children? for example by a modifier? Something like
    @Composable
    fun Content() {
       Column(Modifier.childPadding(inner = 4.dp)) {
           Text("...")
           Text("...")
           Text("...")
       }
    }
    g
    h
    • 3
    • 4
  • r

    Ravi

    04/18/2021, 10:14 PM
    when clicking back after bottom sheet collapsed app is crashing. I've used Backhandler present in activity compose lib to collapse the sheet on back click.
    java.lang.IllegalArgumentException: The target value must have an associated anchor.
            at androidx.compose.material.SwipeableState$animateTo$$inlined$collect$1.emit(Collect.kt:135)
    🧵 1
    c
    • 2
    • 1
  • d

    dimsuz

    04/18/2021, 11:07 PM
    Hello! If I do
    Content(viewStates.collectAsState().value)
    
    @Composable fun Content(state: ViewState) {
      Text(text = state.title)
      Text(text = state.description)
    }
    Would both Texts be always recomposed even if (for example) there were 5 emissions and in all 5 only title was changing?
    a
    z
    • 3
    • 4
  • m

    miqbaldc

    04/19/2021, 6:42 AM
    we’re partially migrating our Views to Jetpack Compose, when we’re configuring the onclick for button/text, we notice a lags 😞 any references or best practices to smooth the animation when clicking text/button?
    most of our code was referenced from official jetpack compose samples
    a
    m
    a
    • 4
    • 7
  • n

    Nathan Castlehow

    04/19/2021, 8:16 AM
    Hi, I have a question relating to matchParentSize / Intrinisic layouts. The use case is i have an accordion looking structure where i click sections to expand them. Alongside this whole structure I want a bar to match the height, including when it expands (more details in thread).
    ➕ 1
    z
    • 2
    • 12
  • s

    Slava Glushenkov

    04/19/2021, 3:27 PM
    Seems like similar question. Let say i have:
    Row{
      LargeComposable{}
      Column{
        SmallComposable()
        ...
        SmallComposable()
      }
    }
    How can I reach Column height same as LargeComposable height. With ConstraintLayout I use     
    height = Dimension.fillToConstraints
    a
    • 2
    • 2
  • z

    zoha131

    04/19/2021, 3:57 PM
    I am facing a weird issue where AS can’t understand basic Kotlin features. e.g.
    contains(), count()
    methods on String and
    listOf(), forEach()
    methods for collections. Have anyone faced this issue recently?
    ➕ 2
    d
    s
    +5
    • 8
    • 23
  • l

    Lilly

    04/19/2021, 5:18 PM
    Where could I start to look, if preview function is broken. It shows only "Initializing...". I'm using AS Canary 14 with embedded JDK and Kotlin 1.5.0-RC plugin installed. Even an new project is broken so it's not project related. Any ideas?
    c
    c
    • 3
    • 15
  • z

    Zach Klippenstein (he/him) [MOD]

    04/19/2021, 5:32 PM
    Question about font weight. It is represented by an integer, and the standard weights are increments of 100. This suggests that it should be possible to (somewhat) smoothly animate between weights. However, when I try doing so, at least with the standard system font on a Pixel 3, it looks like the actual weight values are being coerced to a fixed set of weight steps. So it would seem like the weight values are not being used to somehow dynamically draw the weights. It makes sense that the font is just asked to provide glyphs as close as possible to the weight, so I’m not surprised, but just wanted to confirm.
    s
    r
    a
    • 4
    • 17
  • s

    Sebastian Neagrau

    04/19/2021, 6:10 PM
    Hello! I'm new to Jetpack Compose and I've been struggling to do something kinda basic. Is it possible to have a
    Row
    inside a
    Surface
    and specify the Row's width to be 300% of it's parent ? (the Surface) . In my row I want to have 3 Columns, those will have width 33% relative to the Row(which is 300% relative to my Surface/Phone), that means that my Columns will have the width 100% (relative to my Surface/Phone). So I will get in the end like a Carousel, a horizontal scrolling list that's overflowing the screen I might be taking a wrong approach, so if you have any other alternatives that's even better
    c
    • 2
    • 3
Powered by Linen
Title
s

Sebastian Neagrau

04/19/2021, 6:10 PM
Hello! I'm new to Jetpack Compose and I've been struggling to do something kinda basic. Is it possible to have a
Row
inside a
Surface
and specify the Row's width to be 300% of it's parent ? (the Surface) . In my row I want to have 3 Columns, those will have width 33% relative to the Row(which is 300% relative to my Surface/Phone), that means that my Columns will have the width 100% (relative to my Surface/Phone). So I will get in the end like a Carousel, a horizontal scrolling list that's overflowing the screen I might be taking a wrong approach, so if you have any other alternatives that's even better
c

Colton Idle

04/19/2021, 6:14 PM
Seems like you want to build a "carousel" I haven't done so yet, but from lurking around I think there's 3 main approaches? 1. Row 2. LazyRow (samples) 3. Pager from accompanist I guess if you wanted some snapping functionality you would use the pager, but LazyRow is probably what I would use first. I hope that one day someone creates a Carousel (like Epoxy has) because you can control how many items are on the screen, and you can do something like 1.25F so that a piece of the next item is visible. Really handy in epoxy. Not sure if compose can do that now easily.
s

Sebastian Neagrau

04/19/2021, 6:19 PM
Yeah that's something I was looking for. I've been trying to do it using Row and Column so far, but I couldn't get the sizing to work using things like 1F. And I do not really want to use dp or a fixed size for this one. Basically my problem is more like percentage/weight related 😞
👍 1
c

Colton Idle

04/19/2021, 6:49 PM
🤞 someone else will chime in. Sorry I couldn't help!
View count: 3