Koneko Toujou
09/11/2021, 3:01 PMModifier.padding
Modifier.offset
(or any other position modifier)
Modifier.requiredHeight
(or any other size modifier)
For example
Text(
modifier = Modifier
.padding(horizontal = 16.dp)
.requiredHeight(50.dp)
.offset(10.dp)
)
And
Text(
modifier = Modifier
.requiredHeight(50.dp)
.offset(10.dp)
.padding(horizontal = 16.dp)
)
In which both have a height of 50 and offset of 10, and a padding of 16Adam Powell
09/11/2021, 3:03 PMKoneko Toujou
09/11/2021, 3:04 PMKoneko Toujou
09/11/2021, 3:13 PMModifier.offset(...).requiredHeight(...).padding(...)
How is it possible to apply padding to an offset and modified height?Adam Powell
09/11/2021, 3:16 PMKoneko Toujou
09/11/2021, 3:17 PMKoneko Toujou
09/11/2021, 3:19 PMKoneko Toujou
09/11/2021, 3:20 PMAdam Powell
09/11/2021, 3:23 PMModifier.padding(16.dp).height(50.dp)
will produce an element that takes up 66dp: 50 for the content and 16 for the padding. In contrast,
Modifier.height(50.dp).padding(16.dp)
will produce an element that takes up 50dp: 16 for the padding and 34 for the content. The padding subtracted from the 50dp of available space requested by .height
.Adam Powell
09/11/2021, 3:25 PMKoneko Toujou
09/11/2021, 3:26 PMSize 20 (0, 0, 20, 20)
Pad 2 (2, 2, 16, 16)
MinHeight 20 Invalid
available space 14
Vs
Size 20 (0, 0, 20, 20)
MinHeight 20 (0, 0, 20, 20)
Pad 2 (2, 2, 16, 16)
available space 14
Koneko Toujou
09/11/2021, 3:41 PM