Nat Strangerweather
09/10/2020, 4:16 PMromainguy
09/10/2020, 4:24 PMNat Strangerweather
09/10/2020, 4:26 PMNat Strangerweather
09/10/2020, 4:27 PMNat Strangerweather
09/10/2020, 4:27 PMNat Strangerweather
09/10/2020, 4:39 PMromainguy
09/10/2020, 4:41 PMNat Strangerweather
09/10/2020, 4:44 PMNat Strangerweather
09/10/2020, 4:45 PMZach Klippenstein (he/him) [MOD]
09/10/2020, 4:54 PMcaelum19
09/10/2020, 4:59 PMNat Strangerweather
09/10/2020, 4:59 PMNat Strangerweather
09/10/2020, 5:06 PMcaelum19
09/10/2020, 5:16 PMcaelum19
09/10/2020, 5:17 PMcaelum19
09/10/2020, 5:17 PMcaelum19
09/10/2020, 5:18 PMNat Strangerweather
09/10/2020, 5:35 PMZach Klippenstein (he/him) [MOD]
09/10/2020, 5:47 PMCard(
shape = RoundedCornerShape(20.dp),
backgroundColor = Color(0xffFFAB91),
modifier = Modifier
.clickable(onClick = { })
.height(150.dp)
.width(150.dp)
.padding(10.dp)
) {
You could, for example, do something like:
Card(
shape = RoundedCornerShape(20.dp),
backgroundColor = Color(0xffFFAB91),
modifier = Modifier
.clickable(onClick = { })
.padding(10.dp)
.aspectRatio(1f)
.fillMaxSize()
) {
Chris Sinco [G]
09/10/2020, 5:49 PMweight
Modifier that helps size things relative, similar to percentage (which we don't have yet). Also the ConfigurationAmbient
is available to query the device dimensions that you can use inline to decide how to size things.Zach Klippenstein (he/him) [MOD]
09/10/2020, 5:51 PMfillMaxSize()
might not actually work here, weight
is better. Wouldn’t it be better to use WithConstraints
instead of ConfigurationAmbient
for this case, since it probably matters more what the constraints of this actual grid are, not the real screen size?