nglauber
07/03/2020, 6:08 PMLeland Richardson [G]
07/03/2020, 6:10 PMAdam Powell
07/03/2020, 6:11 PMLeland Richardson [G]
07/03/2020, 6:12 PMAdam Powell
07/03/2020, 6:13 PMSpacer
elementLeland Richardson [G]
07/03/2020, 6:13 PMAdam Powell
07/03/2020, 6:14 PMLeland Richardson [G]
07/03/2020, 6:14 PMAdam Powell
07/03/2020, 6:15 PMnglauber
07/03/2020, 6:15 PMLeland Richardson [G]
07/03/2020, 6:15 PMAdam Powell
07/03/2020, 6:16 PMLeland Richardson [G]
07/03/2020, 6:16 PMAdam Powell
07/03/2020, 6:16 PMLeland Richardson [G]
07/03/2020, 6:17 PMAdam Powell
07/03/2020, 6:18 PMnglauber
07/03/2020, 6:20 PMLeland Richardson [G]
07/03/2020, 6:20 PMAdam Powell
07/03/2020, 6:21 PMPadding
eventually over thereLeland Richardson [G]
07/03/2020, 6:21 PMI feel like we do have solid definitions for these thingsIf we do, I have not seen them. I think most of us understand how the system works, but we haven’t solidifed names for what the conceptual “box” of a modifier in a modifier chain is, and what the thing to the “right” and “left” of it is referred to. Most of the terms we use end up having ambiguities but we sludge through it because we can glean just enough based on context of what the person is talking about
Adam Powell
07/03/2020, 6:23 PMMeasurable
that gets measured with given constraints, and the resulting Placeable
, which has a defined width/height.nglauber
07/03/2020, 6:30 PMLeland Richardson [G]
07/03/2020, 6:34 PMnglauber
07/03/2020, 6:35 PMRow(
modifier = Modifier.drawBackground(color = Color.Red)
.padding(16.dp)
// .margin(16.dp)
) {
Text("1")
Text("2")
Text("3")
}
I want the Row
content to be red + margins…Leland Richardson [G]
07/03/2020, 6:40 PMAdam Powell
07/03/2020, 6:41 PMLayoutParams
-style margin
paralleling how it works in android todayLeland Richardson [G]
07/03/2020, 6:41 PMAdam Powell
07/03/2020, 6:41 PMLeland Richardson [G]
07/03/2020, 6:42 PMAdam Powell
07/03/2020, 6:43 PMLeland Richardson [G]
07/03/2020, 6:43 PMAdam Powell
07/03/2020, 6:45 PMLeland Richardson [G]
07/03/2020, 6:47 PMhenrikhorbovyi
07/03/2020, 7:05 PMAdam Powell
07/03/2020, 7:08 PMandroid:layout_weight
to a child into a parent context that doesn't support that without having some hints from the compiler that something is up. And supporting something like collapsing margins is something a parent layout really does need to be involved in.henrikhorbovyi
07/03/2020, 7:18 PMSergey Y.
07/03/2020, 7:52 PMLayoutParams
is just one such examples.
The similarity to the previous framework is an important thing, but not the main one. If we will pull the same bad architecture design decisions, then what's the point? More bold decisions need to be made.
When you work with one technology for a long time, the eye is blurred. And it’s already difficult to understand a good design or not when you don’t see anything better.
I am sure the Compose team will do everything in the best way and given us the community a chance to help in this.Leland Richardson [G]
07/03/2020, 8:06 PMnglauber
07/03/2020, 10:43 PMModifier
matters and just the padding
function works for both purposes. Thanks @Leland Richardson [G] and @Adam Powell for you attention. 👍dagomni
07/03/2020, 10:47 PM"[...] I find that most people will just write the code that feels the most natural and its "good enough" most of the time. We want Compose to be the same way. [...]".
Even though with "good enough" you meant performance, I think that in general Compose is the way to make writing UI as much a natural process as it can be. And margins are ingrained in developers' minds, not only on Android, so when we have only padding, something will always be missing. I feel that it's easier to think about either just spacing or margins + padding.
pavi2410
07/04/2020, 12:16 PMAdam Powell
07/04/2020, 12:57 PMBox
composable function is a centerpiece of this ongoing discussionModifier.box
? Does the existence of these helpers defer understanding of the underlying model in a way that hurts more in the long run? Already we're seeing signs of some kind of pathological UI tree shapes resulting from an overuse of Box
and we're keeping an eye on itpavi2410
07/04/2020, 1:57 PM@Composable
fun BoxModel() {
Box(
modifier = Modifier // applies from outside (left) to inside (right)
.size(100.dp)
.drawBackground(Color.Red).padding(4.dp) // margin
.drawBorder(1.dp, Color.Black) // border
.drawBackground(Color.Green).padding(8.dp) // padding
) {
Box(modifier = Modifier.drawBackground(Color.Blue).fillMaxSize())
}
}
Adam Powell
07/04/2020, 2:03 PMBox
there at all, you could just as easily stick this one modifier chain on a Spacer
, Text
, Button
or any other content element itself rather than wrapping it in a container only meant to hold the modifiersVinay Gaba
07/12/2020, 4:41 AMAdam Powell
07/12/2020, 5:34 AMVinay Gaba
07/12/2020, 5:01 PM