Wieso ist bei Android Jetpack Compose beim Modifier (fillMaxSize() vs padding()) die Reihenfolge wichtig?
Hallo,
Wieso ist bei Android Jetpack Compose beim Modifier (fillMaxSize() vs padding()) die Reihenfolge wichtig?
Ich erhalte für die Modifier:
- Modifier.fillMaxSize().padding(16.dp)
- Modifier.padding(16.dp).fillMaxSize()
Nicht das selbe Ergebnis.
Zweiteres erzeugt ein Kleineres Composable -> aber da das eine Doch nach außen wirkt (fillMaxSize) und das andere nach Innen (padding), sollte es mmn nicht wichtig sein, in welcher Reihenfolge ich es definiere.
So wie bei HTML auch.
In advance:
I am not a jetpack programmer and can only draw logical conclusions from the (fastly flying) documentation…
see Padding:
Jetpack Compose doesn’t have a modifier for margin. We should use the padding modifier for both padding and margin. (Depending on the position/order in a sequence of formattings.)
in your case this would mean that a pudding() before Fillmaxsize() as Margin act. Padding() After Fillmaxsize() as Padding
***Declaration under reservation that it is not my area of expertise! 😇