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

    Colton Idle

    01/13/2021, 3:49 AM
    I have a design system that is not like Material at all EXCEPT for the "card" pattern. We want to keep cards and especially their properties for dark theme (where elevation gets converted to brightness)> Anyway. What do you all recommend? Not using Material dependency at all? Copy pasting the card code into my app directly. Or including material dep, and just using a Material card?
    g
    r
    b
    • 4
    • 6
  • s

    Slackbot

    01/13/2021, 5:14 AM
    This message was deleted.
    p
    a
    • 3
    • 2
  • j

    John O'Reilly

    01/13/2021, 5:58 PM
    What's equivalent of SwiftUI's
    GeometryReader
    for getting the dimensions of the screen/window?
    z
    • 2
    • 4
  • t

    tcracknell

    01/13/2021, 6:55 PM
    Hello! Happy New Year! The latest Jetpack Compose minor release, alpha10, is here! You can get it now from Google’s Maven Repository. Release notes are available at https://developer.android.com/jetpack/androidx/versions/all-channel. Please log issues at https://issuetracker.google.com/issues/new?component=612128.
    🎉 43
    👍 3
    🙀 2
    l
    • 2
    • 2
  • j

    juliocbcotta

    01/13/2021, 8:29 PM
    So.. I was wondering... How to modularize (gradle modules) with compose? Since we can't deeplink a function. How to keep features isolated, but still be able to launch a composable that I don't have a direct access to?
    j
    • 2
    • 2
  • a

    allan.conda

    01/14/2021, 10:13 AM
    Updating to alpha10…
    @Deprecated(
        "offsetPx was deprecated. Please use offset with lambda parameters instead.",
        ReplaceWith(
            "offset({x.value}, {y.value})",
            "androidx.compose.foundation.layout.offset",
            "kotlin.math.roundToInt()"
        )
    )
    I can’t find this replacement function 🤔
    a
    • 2
    • 2
  • a

    allan.conda

    01/14/2021, 11:07 AM
    I’m getting this lint
    @Composable properties should be declared with the @Composable annotation on the getter, and not the property itself.
    But it won’t let me do it. What’s the right way?
    ➕ 1
    j
    v
    • 3
    • 3
  • k

    Kai Zhu

    01/14/2021, 11:45 AM
    Note: Modifiers can play a similar role to XML attributes in the View system, but the type safety of scope-specific modifiers helps you to discover and understand what is available and applicable to a certain layout. Compare this with XML layouts where it was not always clear if a layout attribute was applicable to a given View.
    This is copied from the Jetpack Compose Codelab "Layouts in Jetpack Compose". But it's not true as far as I know, because xml layouts does have the ability to tell if a layout attribute is applicable to a given View. Am I wrong or have I misunderstood what the doc says? Source: https://developer.android.com/codelabs/jetpack-compose-layouts?continue=https%3A%2F%2Fd[…]developer.android.com%2Fcodelabs%2Fjetpack-compose-layouts
    i
    a
    • 3
    • 8
  • a

    allan.conda

    01/14/2021, 1:00 PM
    Trying out LazyVerticalGrid. Seems to work great however I’m not able to easily add a row at the end to display a loader for infinite scroll since I can only add grid-cells with the available API.
    • 1
    • 1
  • a

    allan.conda

    01/14/2021, 1:37 PM
    One of my AndroidViews are re-inflating on alpha10 on every recompose. I’m curious what causes a reinflate for an AndroidView. Can anyone help shed light on this? The documentation says it should only run exactly once.
    j
    • 2
    • 4
  • j

    jaqxues

    01/14/2021, 2:02 PM
    animate
    has been deprecated and should now be
    animateAsState
    however, there are 2 different top level functions for
    T
    , and one for
    Color
    androidx.compose.animation.animateAsState
    (Color)
    androidx.compose.animation.core.animateAsState
    (T) Is that intended?
    j
    d
    • 3
    • 4
  • d

    dimsuz

    01/14/2021, 5:36 PM
    is there a way to remember a layout height in compose? Use-case: • I have some Box positioned in the screen (it's inside the Column) • User hits some button, some job begins • Now I want to hide the box and show a CircularIndicator positioned at that (now invisible) Box's center In code I do something like
    if (isJobRunning) Box() else CircularIndicator()
    but that makes progress bar jump. In old View system I would wrap them both in FrameLayout and have the indicator use
    layout_gravity=center
    while setting
    box.visibility = INVISIBLE
    . What path should I take in Compose?
    v
    • 2
    • 8
  • v

    Vsevolod Ganin

    01/14/2021, 5:50 PM
    Is it ok that
    onSizeChanged
    reports size without padding?
    @Preview
    @Composable
    fun Test() {
        val density = AmbientDensity.current
        Box(
            modifier = Modifier
                .padding(with(density) { 50.toDp() })
                .size(with(density) { 50.toDp() })
                .background(Color.Red)
                .onSizeChanged { println(it) }
        )
    }
    I expect this to print
    150 x 150
    , but get
    50 x 50
    instead.
    l
    • 2
    • 4
  • a

    alorma

    01/14/2021, 6:29 PM
    Hi! Any blog post, tutorial, anything... about compose animations, for dummies, given that I even not do animations on old android?
    k
    d
    • 3
    • 10
  • a

    alorma

    01/14/2021, 7:13 PM
    Hi! How to solve this error on composable preview? compose:alpha10, ui-tooling:alpha07
    java.lang.NoSuchMethodError: 'androidx.compose.runtime.SlotTable androidx.compose.runtime.Composer.getSlotTable()'   at androidx.ui.tooling.InspectableKt.Inspectable(Inspectable.kt:63)   at androidx.ui.tooling.preview.ComposeViewAdapter$WrapPreview$1.invoke(ComposeViewAdapter.kt:357)   at androidx.ui.tooling.preview.ComposeViewAdapter$WrapPreview$1.invoke(ComposeViewAdapter.kt:-1)   at androidx.compose.runtime.internal.ComposableLambda.invoke(ComposableLambda.kt:146)   at androidx.compose.runtime.internal.ComposableLambda.invoke(ComposableLambda.kt:-1)   at androidx.compose.runtime.AmbientKt.Providers(Ambient.kt:188)   at androidx.ui.tooling.preview.ComposeViewAdapter.WrapPreview(ComposeViewAdapter.kt:356)   at androidx.ui.tooling.preview.ComposeViewAdapter.access$WrapPreview(ComposeViewAdapter.kt:-1)   at androidx.ui.tooling.preview.ComposeViewAdapter$init$1.invoke(ComposeViewAdapter.kt:397)   at androidx.ui.tooling.preview.ComposeViewAdapter$init$1.invoke(ComposeViewAdapter.kt:-1)   at androidx.compose.runtime.internal.ComposableLambda.invoke(ComposableLambda.kt:146)   at androidx.compose.runtime.internal.ComposableLambda.invoke(ComposableLambda.kt:-1)   at androidx.compose.runtime.AmbientKt.Providers(Ambient.kt:188)   at androidx.compose.ui.platform.AmbientsKt.ProvideCommonAmbients(Ambients.kt:274)   at
    i
    n
    • 3
    • 13
  • t

    Tony Kazanjian

    01/14/2021, 7:28 PM
    Is it possible to create an Icon composable with a Resource ID? If not, what's the best way to do it with a vector drawable?
    a
    m
    • 3
    • 3
  • s

    spencer

    01/14/2021, 9:54 PM
    How can I hide the TopAppBar when scrolling a LazyList like I would typically do with a CoordinatorLayout?
    c
    • 2
    • 2
  • n

    Nat Strangerweather

    01/14/2021, 10:18 PM
    Is it possible to pass a value from a BroadcastReceiver to a Composable? If so, how? If I use an intent and putExtra, my Composable is not in an Activity so I'm stuck. 🤔
    n
    a
    • 3
    • 15
  • j

    julioromano

    01/15/2021, 11:08 AM
    👋 As per https://twitter.com/chrisbanes/status/1349985729871552512?s=21 Chris is hinting that in alpha09 support for nested scrolling has been released. Can anyone name the relative APIs? :thank-you:
    j
    m
    • 3
    • 3
  • a

    allan.conda

    01/15/2021, 11:43 AM
    Trying to listen to DrawerState so I could clear focus on its content on close. There is a
    confirmStateChange
    callback but seems it is only invoked when dismissed with a swipe gesture. A gentle drag, invoking
    drawerState.close
    , or clicking outside the drawer doesn’t trigger this callback. Makes me think that callback is broken if it’s only valid for a swipe gesture 🤔
    l
    m
    • 3
    • 4
  • g

    grandstaish

    01/15/2021, 1:32 PM
    I can’t search for compose code in cs.android.com anymore, only samples show up. E.g. if I search “Scaffold.kt”, only scaffold samples appear. Is this a known issue?
    j
    • 2
    • 4
  • a

    Ali Albaali

    01/15/2021, 3:02 PM
    Is there difference between passing composable emptyContent VS null ?
    @Composable
    fun SomeComposable(content : @Composable (() -> Unit)? = null) {}
    @Composable
    fun OtherComposable(content : @Composable () -> Unit = emptyContent()) {}
    a
    • 2
    • 4
  • a

    audriusk

    01/15/2021, 5:55 PM
    Let's say I have such code
    @Composable
    fun ComposableA() {
      val stateA by savedInstanceState { "id" }
    
      ComposableB(stateA) // <-- How to drop all subtree state on stateA change?
    }
    
    @Composable
    fun ComposableB(state: String) {
      val stateB by savedInstanceState { "stateB" }
      
      // deep nested structure with more states
    }
    I want
    ComposebleB
    to be composed with fresh child states when
    stateA
    changes. What would be right way to achieve such behavior?
    c
    • 2
    • 2
  • b

    Bradleycorn

    01/15/2021, 6:35 PM
    Are there any settings to control the "dimensions" of @Previews that are rendered?
    m
    • 2
    • 5
  • m

    Mikołaj Kąkol

    01/15/2021, 7:49 PM
    hello fellow composers, question about state keeping. I have two tabs. Only one of them is visible at given time, hence when
    tabA
    is visible
    tabB
    is not in composition tree. My problem is that when I switch between them state is not remembered, for example scroll state. How can I tell to compose to remember this discarded tab, that it can be needed soon? (sample code in thread)
    a
    t
    • 3
    • 7
  • v

    Vitor Prado

    01/15/2021, 7:50 PM
    is it an practical example of theming in compose? The material theme class is enough? or should I make my own theme class?
    k
    n
    • 3
    • 2
  • g

    Geert

    01/15/2021, 9:25 PM
    Is there already a FloatingActionMenu somewhere? https://github.com/Clans/FloatingActionButton
    a
    c
    • 3
    • 3
  • m

    Mia Clapham

    01/15/2021, 10:06 PM
    Hi there, I'm working on migrating an existing app to Compose. We're using viewBinding to wrap our existing design components which works fairly well except in terms of accessibility. I've seen some documentation on using semantics, but not on how to use them properly with custom design elements. If anyone can point me to an article, example or other docs on this I would really appreciate it.
    c
    b
    j
    • 4
    • 9
  • c

    Colton Idle

    01/15/2021, 10:15 PM
    Typing into a text field in a lazy column is laggy (even in the state codelab where it does this) Is that an issue or is there something we can do to fix this?
    a
    s
    j
    • 4
    • 43
  • q

    Qracle

    01/16/2021, 6:54 AM
    Hi, not sure if this is the appropriate channel to ask this question, but will there be support for Material Design Components in SwiftUI (similar to Compose)? I found this issue https://github.com/material-components/material-components-ios/issues/8508, and some other resources online to either create your own from scratch or integrate the existing components to be used in SwiftUI. I hope someone from Google can answer this, thanks!
    👍 1
    s
    • 2
    • 2
Powered by Linen
Title
q

Qracle

01/16/2021, 6:54 AM
Hi, not sure if this is the appropriate channel to ask this question, but will there be support for Material Design Components in SwiftUI (similar to Compose)? I found this issue https://github.com/material-components/material-components-ios/issues/8508, and some other resources online to either create your own from scratch or integrate the existing components to be used in SwiftUI. I hope someone from Google can answer this, thanks!
👍 1
s

Siyamed

01/16/2021, 9:29 PM
That would be a question for the material team, and probably they are not here.
q

Qracle

01/16/2021, 9:44 PM
Thanks, I’ll try finding a better way to contact them.
View count: 3