kioba
06/14/2019, 11:18 AMhttps://cdn-images-1.medium.com/max/1600/1*jZdYRvtKllXu0h0FiGG9Vw.png▾
Manuel Vivo
06/14/2019, 11:22 AM@Composable
fun Scaffold(appBar: @Composable() () -> Unit, @Children body: @Composable() () -> Unit) {
FlexColumn {
inflexible {
appBar()
}
expanded(flex = 1.0f) {
Surface(color = +themeColor{ surface }) {
children()
}
}
}
}
Andrey Kulikov
06/14/2019, 11:43 AMkioba
06/14/2019, 11:45 AMRyan Mentley
06/14/2019, 1:39 PMfeels like at the end everything will be wrapped in a lambdaQuite a lot of stuff ends up wrapped in lambdas - see, for example, the animation system's usage of lambdas. It ends up being rather nice once you're used to it.
kioba
06/14/2019, 4:57 PMUnit
a compose function could return a @Compose () -> Unit or something that wraps it like class Widget(val effect: @Compose () -> Unit)
Leland Richardson [G]
06/14/2019, 5:39 PMkioba
06/15/2019, 7:09 AMfun Text(str: String): Unit
-> fun Text(str: String): Compose
1) That would proved a return type for everyone,
2) we can keep the compiler plugin because all that matter is the execution of the most outer function.
3) lazy evaluationFx
and IO
is the same what #compose tries to achieve with setContent
and @Compose () -> Unit
gildor
06/15/2019, 12:27 PMkioba
06/15/2019, 5:56 PMval text = Text("myLibraryGeneratedText")
// …
setContent {
Scaffold {
appbar = Appbar(),
child = text
}
}
gildor
06/16/2019, 2:06 AMRow(children = listOf(Padding (child = Text("blah")), Padding(child = Text("hlab"))
Supper messy comparing to current syntax, one may do not like returning Unit, but completely screw up ergonomics because of this doesn't look as good idea for me
I would prefer some other solution for scoped componentskioba
06/16/2019, 11:29 AMLeland Richardson [G]
06/16/2019, 4:13 PMval text = @Composable { Text("myLibraryGeneratedText") }
// …
setContent {
Scaffold(
appbar = { Appbar() },
child = text
)
}
Not the same thing, and I understand what you’re trying to get at, but this is the way we went and we believe it has a lot of benefits.gildor
06/17/2019, 2:52 AMkioba
06/17/2019, 8:08 AM