Luca Nicoletti
11/18/2019, 11:11 AMcolor = (+MaterialTheme.colors()).primary
is way uglier than what it used to be: color = +themeColor { primary }
Luca Nicoletti
11/18/2019, 11:11 AMManuel Wrage
11/18/2019, 11:13 AMLuca Nicoletti
11/18/2019, 11:14 AMunaryPlus
so I was not taking that in considerationLuca Nicoletti
11/18/2019, 11:14 AMLuca Nicoletti
11/18/2019, 11:14 AMsikri
11/18/2019, 11:24 AMunaryPlus
be replaced with? Is it known?Luca Nicoletti
11/18/2019, 11:25 AMLuca Nicoletti
11/18/2019, 11:27 AMkioba
11/18/2019, 11:55 AMthemishkun
11/18/2019, 11:56 AMthemishkun
11/18/2019, 11:57 AMLuca Nicoletti
11/18/2019, 12:16 PMSebi Sheldin Sebastian
11/18/2019, 12:25 PMAdam Powell
11/18/2019, 12:56 PMLuca Nicoletti
11/18/2019, 1:17 PMAdam Powell
11/18/2019, 1:21 PMAdam Powell
11/18/2019, 1:23 PMLuca Nicoletti
11/18/2019, 1:26 PMSingleton
, the selector block looks way more kotlin-ish
Luca Nicoletti
11/18/2019, 1:27 PMthemeColor
lets me think Iβm accessing the current theme, whether MaterialTheme.colors()
doesnβt feel Iβm using the theme
I might have setup in outer @Composable
functionsAdam Powell
11/18/2019, 1:27 PMMaterial.colors.primary
with some debate around effect property getters being a good or bad idea, with I think some degree of team consensus that it encourages less local val aliasing and is probably a good thing. (Since you want to read the underlying ambient in as tight of a scope as possible to avoid unnecessary recompositions)kioba
11/18/2019, 1:28 PMunary+
-> it was helpful for me to quickly scan the code and find the system hooks which gets a provided element.
theme
-> function is a great generic solution doesn't matter if it is material or Company specific design.
lambda
-> as @Luca Nicoletti mentioned super flexible for merging and anything really to apply on the style before usage. it is Kotlin like.Luca Nicoletti
11/18/2019, 1:28 PMLuca Nicoletti
11/18/2019, 1:28 PMAdam Powell
11/18/2019, 1:29 PMLuca Nicoletti
11/18/2019, 1:29 PMAdam Powell
11/18/2019, 1:29 PMLuca Nicoletti
11/18/2019, 1:30 PMAdam Powell
11/18/2019, 1:30 PMLuca Nicoletti
11/18/2019, 1:30 PMcurrentTheme
but the default Material
with the new solution?Luca Nicoletti
11/18/2019, 1:31 PMMaterial.colors.primary
nor (+MaterialTheme.colors()).primary
suggest Iβm accessing the current themeAdam Powell
11/18/2019, 1:31 PMAdam Powell
11/18/2019, 1:32 PM.let {}
away if you need it and it doesn't make sense to make everyone else pay the cognitive overhead just so that it can be cuteAdam Powell
11/18/2019, 1:32 PM.run
)Luca Nicoletti
11/18/2019, 1:32 PMAdam Powell
11/18/2019, 1:33 PMLuca Nicoletti
11/18/2019, 1:33 PMLuca Nicoletti
11/18/2019, 1:33 PMAdam Powell
11/18/2019, 1:34 PMLuca Nicoletti
11/18/2019, 1:34 PMAdam Powell
11/18/2019, 1:34 PMAdam Powell
11/18/2019, 1:34 PMAdam Powell
11/18/2019, 1:36 PMLuca Nicoletti
11/18/2019, 1:37 PMSebi Sheldin Sebastian
11/18/2019, 1:37 PMkioba
11/18/2019, 1:37 PMAdam Powell
11/18/2019, 1:38 PMAdam Powell
11/18/2019, 1:39 PMDispatchers.Main
?kioba
11/18/2019, 1:41 PMAndroidSchedulers.mainThread()
πkioba
11/18/2019, 1:41 PMdagger
Sebi Sheldin Sebastian
11/18/2019, 1:42 PMLuca Nicoletti
11/18/2019, 1:43 PMMaterial
is even worse in my opinion, what if I have my design system?Adam Powell
11/18/2019, 1:44 PMSebi Sheldin Sebastian
11/18/2019, 1:44 PMAdam Powell
11/18/2019, 1:45 PMLuca Nicoletti
11/18/2019, 1:46 PMAdam Powell
11/18/2019, 1:47 PMAdam Powell
11/18/2019, 1:48 PMAdam Powell
11/18/2019, 1:50 PMAdam Powell
11/18/2019, 1:50 PMkioba
11/18/2019, 1:50 PMLuca Nicoletti
11/18/2019, 1:51 PMAdam Powell
11/18/2019, 1:51 PMAdam Powell
11/18/2019, 1:52 PMthemishkun
11/18/2019, 2:37 PMDaggerComponent.inject(this)
) to skip the burden of passing theme through parent arguments. Current solution seems okay, because it is still βscopedβ to the tree.Adam Powell
11/18/2019, 2:53 PMAdam Powell
11/18/2019, 2:55 PMMaterialTheme.colors
certainly has the appearance of a singleton, but it's an effect call that reads the tree-local ambient same as the dev02 apisLuca Nicoletti
11/18/2019, 2:55 PMLuca Nicoletti
11/18/2019, 2:55 PMthemishkun
11/18/2019, 2:56 PMAdam Powell
11/18/2019, 2:56 PMLuca Nicoletti
11/18/2019, 2:56 PMalso send to # compose
for every message to help readability π§Adam Powell
11/18/2019, 2:58 PMSebi Sheldin Sebastian
11/18/2019, 2:59 PMAdam Powell
11/18/2019, 3:00 PMAdam Powell
11/18/2019, 3:01 PMprintln("Hello, world!")
but for guis πAdam Powell
11/18/2019, 3:01 PMMaterialTheme
object anchor is kind of an experimental discoverability and grouping hook for nowLuca Nicoletti
11/18/2019, 3:02 PMAdam Powell
11/18/2019, 3:03 PMval currentMaterialColors
or similar at the top level would be betterLuca Nicoletti
11/18/2019, 3:03 PMMaterial
? Isnβt it a theme
?Sebi Sheldin Sebastian
11/18/2019, 3:04 PMAdam Powell
11/18/2019, 3:04 PMAmbient
πLuca Nicoletti
11/18/2019, 3:04 PMambientColors
?Adam Powell
11/18/2019, 3:04 PMTreeLocal
because Ambient
sounds too cool and mysterious)Adam Powell
11/18/2019, 3:05 PMThreadLocal
does to discourage casual overuse πAdam Powell
11/18/2019, 3:07 PMLuca Nicoletti
11/18/2019, 3:07 PMcurrentAmbientColors
Sebi Sheldin Sebastian
11/18/2019, 3:07 PMLuca Nicoletti
11/18/2019, 3:07 PMcurrentTreeColors
Adam Powell
11/18/2019, 3:07 PMAdam Powell
11/18/2019, 3:07 PMMaterialTheme
as the anchor came fromAdam Powell
11/18/2019, 3:08 PMcurrent
could become a habit that then autocompletes successfullyAdam Powell
11/18/2019, 3:09 PMLuca Nicoletti
11/18/2019, 3:10 PMcopy
and not to us developers πkioba
11/18/2019, 4:44 PM