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

    Omnieboer

    08/04/2021, 12:30 PM
    Is there a way in which I can automate the packaging of a Desktop Compose app using a CI agent? I've been trying to use a Gitlab-ci Runner. My goal is to automatically make an msi when I push to a certain branch. As far as I understand, one can't use
    packageMsi
    from a linux context, so there goes the docker runner. I've been trying to get it done with a windows-docker executor, but that doesn't seem to be able to reach gradle, and I don't think a win-gradle image exists on Docker Hub (at least I couldn't find one). I'm sorry if this has been asked before.
    b
    • 2
    • 9
  • m

    Marcello Galhardo

    08/04/2021, 1:46 PM
    Hi, how wrong is it to rely on
    NavDestination.createRoute
    to use
    Parcelable
    with Navigation Component when using the new Route System (String based) for Fragments/Composables? I understand that it is an internal API, and I’m not supposed to use it, so I’m coming here to find a better option before making a final decision (see the thread for more details). I appreciate any help you can provide.
    i
    • 2
    • 6
  • a

    Azam Khan

    08/04/2021, 2:49 PM
    What's the best way to achieve this layout? I'm currently offsetting my image but that causes spacing issues so is there a better way?
    a
    c
    l
    • 4
    • 9
  • m

    Mike Speed

    08/04/2021, 3:27 PM
    Hi all, I have this issue with StateFlow: MainActivity:
    ...
        val loading = binding.loading
        loading.setContent {
            LoadingSpinner()
        }
    ...
    
    @Preview
    @Composable
    fun LoadingSpinner() {
        if (viewModel.loadingState.value) {
            CircularProgressIndicator()
        }
    }
    in my viewmodel:
    _loadingState.value = true
    viewModelScope.launch {
        doSomeLongTask()
        _loadingState.value = false //or calling this at some later point
    }
    LoadingSpinner() is updated correctly when value == true, but then when I set it to false, LoadingSpinner does not get updated and so stays on screen. Any help appreciated!
    f
    z
    • 3
    • 5
  • a

    alorma

    08/04/2021, 5:36 PM
    compose 1.0.1 finally supports kotlin 1.5.21 https://developer.android.com/jetpack/androidx/releases/compose#1.0.1
    👍🏼 1
    ❤️ 2
    :kotlin-intensifies: 24
    👍 4
    🎉 26
    c
    i
    • 3
    • 4
  • c

    Colton Idle

    08/04/2021, 6:22 PM
    Alright, so this was definitely working yesterday and now it's not today and I've spent 3 hours trying to figure out why my composable isn't recomposing when the list contents change. Code in thread.
    h
    a
    • 3
    • 6
  • a

    Alexander Black

    08/04/2021, 6:31 PM
    Is there a way to override `DropdownMenuItem`’s click indication color outside of the material theme? I’ve tried this to no success
    DropdownMenuItem(onClick = { /*TODO*/ }, 
                     modifier = Modifier
                    .indication(
                                interactionSource = remember { MutableInteractionSource() } , 
                                rememberRipple(color = Color.Red))) {
       Text("Some Menu Item")
    }
    v
    c
    l
    • 4
    • 8
  • n

    Nicholas Doglio

    08/04/2021, 6:36 PM
    Is anyone else facing compiler issues in projects with multi-modules?
    Caused by: org.jetbrains.kotlin.codegen.CompilationException: Back-end (JVM) Internal error: Couldn't inline method call 'Row$default' into
    @androidx.compose.runtime.Composable public fun Error(): kotlin.Unit
    Possible related issue: https://issuetracker.google.com/issues/189138228 Working with Compose in a small sandbox app works fine but as soon as I try to integrate it into our main app I get the above error when using any Composable that’s an inline function (
    Row
     and 
    Column
     for example) We started playing with Compose during the first RC and have seen it since then and continue to see it in todays 1.0.1 release
    m
    • 2
    • 3
  • c

    Colton Idle

    08/04/2021, 7:44 PM
    androidx.compose.ui.ui-1.1.0-alpha01
    👀
    :kotlin-intensifies: 4
    👀 1
    a
    • 2
    • 2
  • c

    Colton Idle

    08/04/2021, 9:09 PM
    I'm just trying to pin a Crossfade with a button at the bottom of the screen with weight 1f. I can pin the button at the bottom of the screen, but once I wrap it with Crossfade it pins the button at the top of the screen. Code in thread.
    a
    c
    d
    • 4
    • 11
  • z

    Zach Klippenstein (he/him) [MOD]

    08/04/2021, 10:15 PM
    Is this not required for Compose 1.0 anymore? Seems to build just fine without it.
    composeOptions {
        kotlinCompilerExtensionVersion "…"
      }
    e
    t
    +4
    • 7
    • 12
  • p

    PHondogo

    08/04/2021, 10:45 PM
    Hello! How can i adjust compose view to keyboard show/hide?
    l
    c
    • 3
    • 4
  • d

    Dominaezzz

    08/04/2021, 10:47 PM
    Would it make sense to create (and dispose with
    DisposableEffect
    ) a
    Composition
    in the
    skippableUpdate
    parameter of
    ComposeNode
    ?
    • 1
    • 1
  • i

    Ink

    08/04/2021, 10:47 PM
    Row() {
        Canvas(modifier = Modifier.size(20.dp)) {
            drawCircle(
                color = Color.Gray,
                center = Offset(x = 10f, y = 10f),
                radius = size.minDimension / 4,
            )
        }
        Canvas(modifier = Modifier.size(20.dp)) {
            drawCircle(
                color = Color.Gray,
                center = Offset(x = 10f, y = 10f),
                radius = size.minDimension / 4,
            )
        }
    }
    How Can I update color of specific circle based on index number?
    d
    c
    • 3
    • 3
  • i

    itnoles

    08/05/2021, 1:36 AM
    What is NavigationRail?
    i
    • 2
    • 1
  • c

    Colton Idle

    08/05/2021, 3:27 AM
    Anyone else do a bunch of updates today (latest alpha androidx everything, compose 1.0.1 or 1.1.0-alpha01 and kotlin 1.5.21) and hilt started breaking? Been trying to diagnose this now for a few hours. Throwing in the towel for now and reverting. https://github.com/google/dagger/issues/2800
    i
    i
    • 3
    • 6
  • m

    MaxUt

    08/05/2021, 7:43 AM
    Hi there, I'm using Hilt to inject dependencies. I was wondering if it's possible to instanciate an object which contains depencies (injected with Hilt) in a Composable ?
    c
    t
    k
    • 4
    • 22
  • n

    nlindberg

    08/05/2021, 8:49 AM
    What would be a good approach to building a “modular” composable. e.g. something that has a header,content,footer section. Would you you write it like fun Container(header: () -> Composable, content: () -> Composable, footer: () -> Composable): Composable ?
    a
    r
    +2
    • 5
    • 5
  • t

    Tin Tran

    08/05/2021, 10:46 AM
    Hi! I’m using navigation-compose alpha06 and having crashes whenever I tried to popBackStack from a nested navigation. Does anyone having the same issue? Sample code in 🧵
    i
    • 2
    • 12
  • m

    Marko Novakovic

    08/05/2021, 1:08 PM
    what is the best way to expose state from
    ViewModel
    ? am using compose’s
    MutableState
    but I see a lot of examples with
    Flow
    but I don’t see any need for using
    Flow
    to expose state in pure compose app. is
    Flow
    used in app in transition from
    View
    to
    Compose
    to bridge the gap and use some of the existing code or
    Flow
    is for some reason more favourable than
    MutableState
    ?
    c
    a
    m
    • 4
    • 10
  • p

    PHondogo

    08/05/2021, 1:23 PM
    Is it possible to make extra padding for content in Scaffold if FAB is showing? Or may be there are more correct way to handle FAB overlaping?
    c
    e
    +2
    • 5
    • 17
  • a

    Alexander Black

    08/05/2021, 3:53 PM
    In Compose do you typically inline define menu items using maybe something like listOf(“menu item 1”, “menu item 2" … etc) or would you load menu items from a menu XML like you used to?
    v
    a
    • 3
    • 6
  • a

    alorma

    08/05/2021, 4:53 PM
    Hello! I 've a compose test on here: https://github.com/alorma/Coupons but trying to run it it always says:
    junit.framework.AssertionFailedError: No tests found in com.alorma.coupons.CouponTicketTest
    code in thread
    v
    • 2
    • 5
  • f

    Florian

    08/05/2021, 6:05 PM
    Let's say you have some logic in your ViewModel that should trigger a snackbar in your UI/Composable. How do you send that event? In XML times I used an event channel but this doesn't seem to work well with Compose since 2 times the same snackbar text in a row gets ignored by the
    mutableStateOf
    holder.
    c
    a
    +2
    • 5
    • 50
  • c

    Chris Johnson

    08/05/2021, 7:46 PM
    Is there a way to go through one measure pass in a custom layout and then before laying out children, re-measure with a different set of constraints calculated from the first measurement? Essentially I think I'm trying to use
    Intrinsics
    in a custom layout because I want all my children to be the height of the largest child. Is there an easier way to solve this? I could potentially just use out of the box Layouts + Intrinsics but I'd like to try and solve it with a custom layout.
    d
    m
    f
    • 4
    • 6
  • p

    PHondogo

    08/05/2021, 9:16 PM
    How to make loading new chunk of items in LazyColumn when user scroll to last item?
    s
    • 2
    • 1
  • s

    Smorg

    08/05/2021, 9:30 PM
    Hi, I am getting the dreaded
    java.lang.Class<ViewModel> has no zero argument constructor
    error when using the
    hiltViewModel
    function. Being stuck on this for over two hours now. I have added all the required libs and annotations but the error won’t go. Any help will be appreciated.
    c
    t
    • 3
    • 6
  • f

    Florian

    08/05/2021, 9:42 PM
    This is how I send a result from an edit screen back to the parent screen on the backstack. But I would like to receive this event only once (like it is the case for the old fragment result API). Is there a way to do that?
    composable(TodoScreen.TodoList.name) { navBackStackEntry ->
                TodoListScreen(
                    [...]
                    addEditResult = navBackStackEntry.savedStateHandle.get<Int>(KEY_ADD_EDIT_RESULT)
                )
            }
    As far as I see, I will always receive this result on every recomposition (like when the screen is rotated) causing to show feedback snackbars again.
    i
    • 2
    • 21
  • f

    Florian

    08/05/2021, 10:05 PM
    Does
    LazyColumn
    not yet keep scroll position after config changes or is my setup just wrong?
    a
    c
    +2
    • 5
    • 6
  • a

    Alexander Black

    08/05/2021, 11:22 PM
    is there any way to remove the default padding from OutlinedTextField? Or do I need to make a custom text field to do that?
    c
    • 2
    • 2
Powered by Linen
Title
a

Alexander Black

08/05/2021, 11:22 PM
is there any way to remove the default padding from OutlinedTextField? Or do I need to make a custom text field to do that?
c

Colton Idle

08/06/2021, 12:04 AM
This question comes up often. Here is an issuetracker to star 😄 https://issuetracker.google.com/issues/189971673
a

Alexander Black

08/06/2021, 3:43 AM
Excellent! Thank you.
View count: 2