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

    Luca Nicoletti

    10/18/2019, 7:52 PM
    Any idea why the
    FlexColumn
    compose the 2
    Text
    in a row instead of a column?
    Displayed in a row - not in a column
    l
    a
    • 3
    • 9
  • l

    Leland Richardson [G]

    10/18/2019, 10:41 PM
    this is broken for us to atm. someone working to fix it now
    w
    c
    • 3
    • 3
  • l

    Luca Nicoletti

    10/20/2019, 6:01 PM
    Ok, I got another weird scenario with `Ripple`s, but it’s someway complex to explain - and I don’t want to copy-paste that much code, who can I get in touch with?
    a
    • 2
    • 1
  • l

    Luca Nicoletti

    10/21/2019, 11:27 AM
    Will this be
    suppressed
    by default for
    @Composable
    functions?
    :yes: 1
    🙏 1
    s
    k
    • 3
    • 2
  • w

    wasyl

    10/21/2019, 10:49 PM
    I tried searching but didn’t find anything that helps and I’m confused. Should I expect the views to change/recompose when passing
    @Model
    into another
    @Composable
    function? Something like:
    @Composable
    fun App() {
        val appState = +memo {
            ParentModel(
                listOf(
                    ChildModel("Item 1", false),
                    ChildModel("Item 2", true)
                )
            )
        }
        Column {
            appState.childModels.forEach { item ->
                Item(item)
            }
        }
    }
    
    @Composable
    fun Item(item: ChildModel) {
        ListItem(
            text = { Text(item.description) },
            trailing = {
                Checkbox(
                    checked = item.checked,
                    onCheckedChange = { item.checked = it })
            }
        )
    }
    
    @Model
    data class ParentModel(
        var childModels: List<ChildModel>
    )
    
    @Model
    data class ChildModel(
        var description: String,
        var checked: Boolean
    )
    ?
    g
    r
    +3
    • 6
    • 26
  • w

    wasyl

    10/22/2019, 9:56 AM
    Another question: when I’m quickly adding items to a
    ModelList
    , they are being added out of order, that is when I add items slowly I have e.g.
    1, 2, 3, 4, 5
    . But when I click button to add them fast, I end up with
    0, 4, 3, 2, 1
    . Even when I try explicitly adding the item at position
    list.size
    . The same happens for an immutable list. Is this because mutating the state doesn’t guarantee order of the mutation? Is there any way actually have the changes applied in order?
    a
    • 2
    • 4
  • i

    Icaro Temponi

    10/22/2019, 1:14 PM
    Compose artifacts updated to 0.1.0-dev02 https://androidx.tech/updates/2019-10-22-compose-update/
    😮 15
    w
    k
    • 3
    • 3
  • a

    Adam Bennett

    10/22/2019, 5:29 PM
    0.1.0-dev02 seems to break my Compose demo app, so there's definitely been some significant change somewhere
    No direct method <init>(Ljava/lang/String;Lkotlin/jvm/functions/Function0;)V in class Landroidx/compose/Ambient; or its super classes
    f
    c
    • 3
    • 2
  • w

    wasyl

    10/22/2019, 8:50 PM
    I have a question about modifiers: right now I see the only handled
    Modifier
    type is a
    LayoutModifier
    , which, if I understand correctly, is read and applied in the
    LayoutNode
    in appropriate place. I know there’s been a discussion about the scope of modifiers, but in the end there’ll be just some number of modifier types handled by the core library in appropriate places, right? Could you share what other possible types of modifiers were you thinking about in general, not necessarily ones that are likely to be part of Compose?
    a
    r
    +2
    • 5
    • 22
  • d

    dector

    10/23/2019, 6:04 PM
    There are no such items in AS 4.0 Canary 1. 🙂
    👍 1
    j
    f
    • 3
    • 13
  • f

    Fudge

    10/23/2019, 6:05 PM
    Is AS 4.0 a new thing? I just saw happened to see it today
    👍 1
    f
    s
    m
    • 4
    • 10
  • z

    zak.taccardi

    10/23/2019, 7:07 PM
    I'm really interested in Compose, but I currently represent all my data (model) as immutable data. I use
    Flow<T>
    for this. Every instance of
    T
    is immutable all the way down, which has a bunch of advantages.
    @Model
    seems to require use of
    var
    👍 1
    l
    j
    • 3
    • 3
  • l

    louis993546

    10/23/2019, 7:08 PM
    So who will be the first one to ship Compose to play store 🤔
    t
    s
    • 3
    • 3
  • f

    florent

    10/23/2019, 7:19 PM
    I hope compose is gonna kill fragments, that was really a mess
    ⚰️ 2
    p
    g
    • 3
    • 3
  • a

    Andy Gibel

    10/23/2019, 7:27 PM
    Compose can't possibly work with the new MotionLayout animation editor right?
    s
    t
    g
    • 4
    • 4
  • p

    pavi2410

    10/23/2019, 7:33 PM
    @Preview
    @Composable
    fun Greeting(name: String = "Android") {
        Text (text = "Hello $name!")
    }
    Would the preview work by using default values?
    t
    r
    • 3
    • 2
  • p

    passiondroid

    10/23/2019, 7:34 PM
    It seems like Jetpack Compose is much similar to writing UI in Flutter.
    a
    s
    +5
    • 8
    • 20
  • t

    themishkun

    10/23/2019, 7:39 PM
    @Preview
    annotation is actually pretty cool in terms of documenting your UI components library. Good job! Any plans to have a Library tab in Android Studio, similar to ResourceManager, where I could see all of my components annotated with
    @Preview
    ? It would be super cool to have this kind of visual reference of the project guidelines
    ➕ 9
    r
    l
    • 3
    • 5
  • p

    pavi2410

    10/23/2019, 7:46 PM
    Suggestion: What if there is a preview button (next to @Composable functions) in the gutter just like Run button in psvm?
    1 👁️ | @Composable
    2    | fun Greeting(name: String = "Android") {
    3    |    Text (text = "Hello $name!")
    4    | }
    g
    l
    +4
    • 7
    • 45
  • f

    Fudge

    10/23/2019, 7:51 PM
    Will the
    +
    thing for effects be removed? Back then you were saying it's gonna go away.
    g
    f
    +2
    • 5
    • 6
  • a

    Andy Gibel

    10/23/2019, 8:36 PM
    Theoretically, will Compose be compatible with how companies are defining "Design Language" components and shipping as internal libraries?
    r
    • 2
    • 7
  • f

    Fudge

    10/23/2019, 10:09 PM
    I don't seem to be getting a live preview? 😕
    c
    r
    +2
    • 5
    • 18
  • w

    wasyl

    10/23/2019, 10:17 PM
    So we don’t need to use AndroidStudio bundled with Compose anymore?
    f
    r
    • 3
    • 5
  • r

    romainguy

    10/23/2019, 10:22 PM
    It uses layoutlib that's already used by the visual editor
    💯 2
    w
    s
    • 3
    • 3
  • a

    andrew

    10/23/2019, 10:36 PM
    With jetpack compose, how do we access things like view insets, context, etc?
    a
    a
    • 3
    • 5
  • s

    Steve

    10/23/2019, 10:44 PM
    In order to get the live preview, do you have to have something with the @Preview annotation?
    w
    • 2
    • 5
  • c

    Cody Engel

    10/24/2019, 4:25 AM
    Has anyone gotten a
    FloatingActionButton
    to display an image yet? I feel like I’m missing something very simple…
    val resource = +vectorResource(R.drawable.ic_baseline_add)
            FloatingActionButton(icon = resource) // takes an Image instead of Vector, how does one convert a Vector to an Image with Compose?
    a
    • 2
    • 1
  • c

    Cody Engel

    10/24/2019, 5:00 AM
    Would the issue tracker be a good spot to make requests? I was hoping to do something like this:
    @Model
    class Name(var name: String = "Android") : ViewModel()
    But inheritance isn’t currently supported for Model objects. We currently use LiveData a lot today but with Compose it seems like unnecessary overhead.
    t
    l
    +2
    • 5
    • 14
  • c

    Cody Engel

    10/24/2019, 5:32 AM
    Ah gotcha,
    +observe
    isn’t quite I was hoping for, making the entire ViewModel observable with
    @Model
    was more what I was hoping for. I don’t think
    +observe
    currently exists as part of the Canary build either? Android Studio at least can’t recognize it on my end. I’ll try to stop by the office hours tomorrow to talk it through a bit more. Thanks again for all of the help and sorry for bugging ya at 10:30 at night 😅
    l
    a
    l
    • 4
    • 25
  • g

    Gil Goldzweig

    10/24/2019, 5:39 AM
    Guys, great work on the progress. It's great to see that our feedback is actually being listened to. Quick question. Where is it better to write compose functions? In a class or a file?
    c
    s
    a
    • 4
    • 4
Powered by Linen
Title
g

Gil Goldzweig

10/24/2019, 5:39 AM
Guys, great work on the progress. It's great to see that our feedback is actually being listened to. Quick question. Where is it better to write compose functions? In a class or a file?
c

Cody Engel

10/24/2019, 5:43 AM
It seems like file are the preferred route for things annotated with
Composable
. At least the components I’ve been looking at from Compose seem that way.
Text
,
TextField
,
Flex
, etc all end up as top level functions at least.
s

streetsofboston

10/24/2019, 5:47 AM
Since state that needs to be rendered is passed down as input-parameters to these
@Compose
functions, making them static (top-level) seems like a good idea. No 'accidental' using state from the Activity or other such classes to render your 'Compose'd UI.
➕ 1
a

Adam Powell

10/24/2019, 12:54 PM
Composable functions on classes make sense when you're using the class as sort of a place for private hoisted state that the composable uses. We're still playing with some potential recommendations there
View count: 1