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

    gaetan

    05/15/2019, 8:46 AM
    There are a lot of interesting concepts in this project. I have a question regarding View technology. In the current code, as I understand it, the view part is an entirely new one, using only canvas to draw elements on it. However, the building of UI through this kind of code could be attractive in existing contexts. Do you think it would be possible to have something similar with a binding mechanism on an existing technology like, let’s say, HTML?
    r
    g
    +8
    • 11
    • 61
  • f

    Fudge

    05/15/2019, 11:11 AM
    Some questions about syntax: If all dimensions are in
    dp
    , why can't I just put a number, instead of doing
    <number>.dp
    ? What is the deal with the
    +
    operator (in
    style = +themeTextStyle { subtitle1 }
    for example) ? I've read the documentation about it, but I still don't understand the need for it.
    r
    m
    +4
    • 7
    • 40
  • f

    Fudge

    05/15/2019, 9:41 PM
    Right now when you press
    ctrl+space
    in a composable constructor it shows you the suggestions for the current positional parameter (in this case
    TextAlign
    ), and then all of the available optional parameters. Is there plans to bump up the positional parameters in autocompletions of composable constructors? I think It would be a good idea.
    l
    • 2
    • 5
  • s

    SrSouza

    05/15/2019, 9:58 PM
    Hi guys, the Jetpack Compose write their components pixel by pixel using Canvas (if i'm correctly), I was wondering if is possible to write the Canvas in other platform, like Kotlin Native targeting iOS, and use the already created components of Jetpack Compose. I know that this is not the goal of the project, but, it's possible?
    f
    g
    m
    • 4
    • 4
  • g

    galex

    05/16/2019, 4:28 AM
    Will Compose be as fast in rendering as Flutter? I’d like to be able counter-argument colleagues who are trying to push Flutter just because of the 60fps advantage
    n
    g
    +5
    • 8
    • 13
  • l

    Leland Richardson [G]

    05/17/2019, 4:54 AM
    OK. Put this list of talks / blogs together real quick that might be interesting to anyone wanting to understand more about declarative patterns that Compose appeals to: http://intelligiblebabble.com/content-on-declarative-ui/
    👏 26
    👍 7
    r
    b
    • 3
    • 3
  • m

    moetouban

    05/17/2019, 6:45 AM
    this reminds be with a kotlin library called anko i used long time to write dynamic UI through code. https://github.com/Kotlin/anko/wiki/Anko-Layouts
    👍 1
    g
    • 2
    • 2
  • m

    mbonnin

    05/17/2019, 9:14 AM
    Is the source code for
    ScrollingList
    available somewhere ? I can't find it. It's the
    RecyclerView
    equivalent mentionned there:

    https://youtu.be/VsStyq4Lzxo?list=PLOU2XLYxmsILVTiOlMJdo7RQS55jYhsMi&amp;t=1478▾

    r
    b
    r
    • 4
    • 5
  • f

    Fudge

    05/17/2019, 9:16 AM
    Is there a way to try compose on a windows pc?
    m
    m
    d
    • 4
    • 19
  • f

    Fudge

    05/17/2019, 3:10 PM
    It appears that having multiple children under
    Surface
    crashes the app
    a
    l
    • 3
    • 19
  • b

    bloder

    05/17/2019, 4:26 PM
    Hi all, I'm not sure if I understood the
    SlotTable
    responsibility in compose algorithm, it keeps slots and other concepts that are made do manage slots, but what exactly is stored on those slots values, and what its relationship with a compose tree? Is it the core of a compose tree management or something like that? Could anyone explain it, please?
    l
    e
    m
    • 4
    • 16
  • l

    Leland Richardson [G]

    05/17/2019, 6:27 PM
    It doesn't give you a stack Trace or anything?
    g
    • 2
    • 1
  • m

    mbonnin

    05/17/2019, 6:29 PM
    @Gil Goldzweig I had something similar, I had to import compose (or composer, can't remember) even though intellij marks it as unused. This might or might not be the same issue
    g
    • 2
    • 2
  • h

    Hadi Tok

    05/17/2019, 10:34 PM
    I am getting this error while building the project. Anyone have an idea how can I fix it?
    -.kt
    l
    b
    o
    • 4
    • 43
  • f

    Fudge

    05/19/2019, 2:21 PM
    It appears to have been fixed in a recent change.
    m
    • 2
    • 5
  • g

    Gil Goldzweig

    05/19/2019, 4:15 PM
    What is the "recommended" way to position an element? For example: Bottom | Start And is there a plan to make a compose version of constraint layout or motion layout?
    n
    • 2
    • 1
  • r

    romainguy

    05/20/2019, 2:54 AM
    Yes, we have wrappers for existing Android views
    n
    g
    • 3
    • 15
  • a

    Adam Powell

    05/20/2019, 3:06 AM
    They behave as something between an object constructor and update function, and they're basically always nouns
    👍 2
    n
    • 2
    • 6
  • n

    napperley

    05/20/2019, 3:51 AM
    Is it possible to setup all properties in a function call code block and drop the parenthesis? Eg:
    @Composable
    fun StoryWidget(story: StoryData) {
        // ...
        Card {
            cornerRadius = 4.dp
            elevation = 4.dp
            columns += Column {
                children += Image { file = image }
                children += Padding {
                    spacing = 16.dp
                    content = Text { content = story.headline }
                }
            }
        }
    }
    e
    • 2
    • 1
  • r

    romainguy

    05/20/2019, 3:56 AM
    No, the syntax is that of function calls
    ❓ 1
    n
    a
    b
    • 4
    • 15
  • g

    Gil Goldzweig

    05/20/2019, 6:30 AM
    Will there be a version of compose that can be converted in runtime? That way there can be support for custom UI fetched from remote repositories. It can be good for things like custom popups or A/B testings
    e
    a
    +2
    • 5
    • 7
  • s

    streetsofboston

    05/21/2019, 11:42 AM
    Yes, they return Unit, but the Compose annotation is hooked up to a compiler plugin and this causes some magic in generating a model/hierarchy of the views (that is what I understood from my unit-testing question here: https://kotlinlang.slack.com/archives/CJLTWPH7S/p1557666472013700?thread_ts=1557666472.013700&amp;cid=CJLTWPH7S )
    m
    m
    +2
    • 5
    • 13
  • t

    themishkun

    05/21/2019, 12:11 PM
    Any tips on why Compose functions are structured via
    @Compose
    annotation rather than something more common in Kotlin dsl’s
    Compose.foo()
    extensions on some context object? It seems to me that it could make this more extensible and user-friendly than annotations and compiler plugins I’ve read about it somewhere that devs went out from traditional “build-view-tree -> diff-view-tree -> dispatch-changes” way to improve performance. Are there any studies on how much actual performance gained?
    ➕ 1
    💯 2
    👍 2
    r
    l
    +3
    • 6
    • 19
  • a

    Adam Powell

    05/21/2019, 12:50 PM
    Setting aside the performance question entirely, the decision to use unit functions like this is also a win for the API shape itself. If you call something, it's part of the composition. You can use normal looping and control flow constructs without requiring people to use functional map/filter/etc. as the only option
    👎 1
    m
    k
    l
    • 4
    • 4
  • p

    Pedro Gomez

    05/21/2019, 12:54 PM
    that's really interesting because using this API we will be able to write for loops but we close the door to other interesting parts like testing
    l
    v
    • 3
    • 2
  • p

    Pedro Gomez

    05/21/2019, 1:03 PM
    for unit testing, the "virtual dom" or whatever you want to call it could be the key to success
    a
    • 2
    • 3
  • p

    Pedro Gomez

    05/21/2019, 1:05 PM
    let me know if you need a beta tester or something for the testing part. I've been writing tests for Android using many different approaches and it could be awesome if I can help with this part
    g
    • 2
    • 1
  • s

    streetsofboston

    05/21/2019, 1:14 PM
    There is an implicit context in which the ui/tree is rendered, which can be queried, IIRC
    m
    • 2
    • 1
  • a

    Adam Powell

    05/21/2019, 1:14 PM
    They can't. The behavior is similar to
    suspend
    in that they can only be called from other
    @Composable
    functions
    m
    r
    • 3
    • 5
  • f

    Fudge

    05/21/2019, 1:22 PM
    Why'd you say that? 😄
    t
    • 2
    • 1
Powered by Linen
Title
f

Fudge

05/21/2019, 1:22 PM
Why'd you say that? 😄
t

themishkun

05/21/2019, 2:14 PM
because no one uses them
😄 3
View count: 1