Klaas Kabini
02/01/2020, 10:01 AMColumn(modifier = LayoutPadding(16.dp), arrangement = Arrangement.Begin) {
Text(text = "Klaas", style = MaterialTheme.typography().body1)
Spacer(LayoutHeight(12.dp))
Text(text = "James", style = MaterialTheme.typography().body1)
Spacer(LayoutHeight(12.dp))
Text(text = "Tom", style = MaterialTheme.typography().body1)
Spacer(LayoutHeight(12.dp))
Text(text = "Martin", style = MaterialTheme.typography().body1)
Spacer(LayoutHeight(12.dp))
ColoredRect(color = Color.Red, modifier = LayoutWidth.Fill, height = 200.dp)
}
Can’t we have something like this where we can arrange the children of a layout to the beginning but still give the fixed spacing to spaces them evenly without having to put spacers between the items.
Column(modifier = LayoutPadding(16.dp) + ChildSpacing(16.dp), arrangement = Arrangement.Begin) {
Text(text = "Klaas", style = MaterialTheme.typography().body1)
Text(text = "James", style = MaterialTheme.typography().body1)
Text(text = "Tom", style = MaterialTheme.typography().body1)
Text(text = "Martin", style = MaterialTheme.typography().body1)
ColoredRect(color = Color.Red, modifier = LayoutWidth.Fill, height = 200.dp)
}
Adam Powell
02/01/2020, 3:30 PMremember {}
things across config changes? The latter is more our thinking at the moment and would likely use ViewModel
under the hood.LayoutHeight
modifier into a val
and other usual kotlin tactics for avoiding repetition.Klaas Kabini
02/01/2020, 3:41 PMAdam Powell
02/01/2020, 3:41 PMKlaas Kabini
02/01/2020, 3:45 PMAdam Powell
02/01/2020, 3:46 PMViewModel
in particular are you looking for?Klaas Kabini
02/01/2020, 4:08 PMAdam Powell
02/01/2020, 4:34 PMViewModelProvider
for that that you're looking for, or do you want something with equivalent scoping properties? Combining remember
, onCommit
and onDispose
will give you the scoping properties and cleanup if that's the part you're afterKlaas Kabini
02/01/2020, 4:55 PMremember
, onCommit
and onDispose
will infact provide me with what I want. Thanks.Mihai Popa
02/01/2020, 6:58 PMColumn
issue, in addition to what Adam said, note that you can also create your own Arrangement