vide
04/13/2023, 1:11 AMdistanceInMinimumTouchTarget
in LayoutNodeWrapper. I'm looking for a solution that would allow providing a custom minimum size per-element without interfering with the visual layout around it (so no padding)Albert Chang
04/13/2023, 2:36 AMval viewConfiguration = object : ViewConfiguration by LocalViewConfiguration.current {
override val minimumTouchTargetSize: DpSize
get() = DpSize(100.dp, 100.dp)
}
CompositionLocalProvider(LocalViewConfiguration provides viewConfiguration) {
Layout()
}
vide
04/13/2023, 6:40 AMJoel Denke
04/13/2023, 7:21 AMvide
04/13/2023, 7:34 AMJoel Denke
04/13/2023, 7:42 AMvide
04/13/2023, 7:44 AMJoel Denke
04/13/2023, 7:48 AMAlbert Chang
04/13/2023, 7:53 AMModifier.clickable
with your own implementation, which is likely to be much more complicated.vide
04/13/2023, 7:56 AMAlbert Chang
04/13/2023, 8:00 AMonSizeChanged
.Joel Denke
04/13/2023, 9:54 AMvide
04/18/2023, 3:50 AMminimumTouchTargetSize
with LocalViewConfiguration
but I ran into some... unintuitive behaviour with Rows. It doesn't register touches to the ends of the row horizontally, but it works perfectly vertically 🤔 Is this what is supposed to happen or is there some kind of bug in play? See video!// clipping bug(?)
@Composable
fun Demo4() {
val viewConfiguration: ViewConfiguration = LocalViewConfiguration.current
val minTouchViewConfiguration = object : ViewConfiguration by viewConfiguration {
override val minimumTouchTargetSize = DpSize(200.dp, 200.dp)
}
CompositionLocalProvider(LocalViewConfiguration provides minTouchViewConfiguration) {
Box(
Modifier
.size(500.dp)
.background(Color.Red),
contentAlignment = Alignment.Center
) {
Row(
Modifier
.background(Color.White)
.padding(10.dp)
.clip(RoundedCornerShape(30.dp)),
horizontalArrangement = Arrangement.spacedBy(10.dp)
) {
repeat(3) {
Box(
Modifier
.background(Color.Blue)
.size(90.dp)
.clickable { })
}
}
}
}
}
.clip
modifier is applied to the intermediate parent (white background). It works without it.Joel Denke
04/18/2023, 8:52 AMvide
04/18/2023, 2:10 PMclip = true
in .graphicsLayer
the minimum touch size is calculated with that layer without giving the children a chance to test their own minimum areas 🤔.graphicsLayer { clip = true },
in a parent breaks the minimum touch target sizes of the children