dimsuz
01/29/2020, 11:09 PMAdded DrawModifier, a modifier type that is allowed to draw on the surface of the modified layout.I have a fear that this modifier-stuff has a potential to make API quite messy where you can do everything in modifier and they'll be misused. Like some widget will decide that it wants to draw its content with DrawModifier and I can't theme it. Or it will decide to size itself through modifier constraints in some clever way and won't let me size it in the usual way. etc etc Tell me I'm wrong! :)
Ryan Mentley
01/29/2020, 11:48 PMdimsuz
01/30/2020, 12:43 AMdev03
that I could limit a width of Container
either with Container(width=10)
- function argument or with a Modifier.
Someone here told me this is a draft and only one of them will stay, but still, what prevents me as a library author of going the same route?
Although I guess if API would prefer modifiers everywhere this will suggest its users to do likewise.
But still I hope that modifiers end up having clear set of constraints on what you should do with them (and when creating new ones) and what you shouldn't. If they'll be too permissive and generic, this can byte us API-wise.Ryan Mentley
01/30/2020, 12:50 AMContainer
in favor of Box
and encouraging exactly this sort of "there's one way to do it" thing - see, for example, the replacement of HeightSpacer and WidthSpacer with a Spacer that accepts a modifierRyan Mentley
01/30/2020, 12:50 AMmatvei
01/30/2020, 10:27 AMBox(modifier = LayoutSize(100.dp, 100.dp), backgroundColor = Color.Red) { /* your content */ }
and we do all the draw modifiers work for you 😉