TouchDelegate in Compose It has probably been asked before, at least on SO. However, since compose e...
e
TouchDelegate in Compose It has probably been asked before, at least on SO. However, since compose evolve fairly fast I thought I'd ask if there's an API to do what Touch delegate does? as in a modifier property. The alternative is ofc to delegate it my self, but wanted to check before I did that.
t
.size(0.dp).wrapContentSize(Alignment.Center, unbounded = true).size(actualSize)
is one trick
e
awesome, thanks for the suggestion! 👍
t
You're welcome! I use it all the time when I have an IconButton or similar at the edge of a padded layout, so that the extra IconButton padding doesn't push the icon away from the edge
z
sorry to resurrect this thread but what’s an example of using this? my goal is to expand the clickable area around a Composable without pushing other content away (sounds exactly like your icon button use case) i tried this out but in a basic usage an element in a row, leads to the composable rendering outside the bounds of the screen
t
You can do this in one direction only as well
For example,
.height(0.dp).wrapContentHeight(Alignment.CenterVertically, unbounded = true).height(actualHeight)
z
do you need to assign a size/height/width to the composable before using this?
t
at the end of the modifier chain, it needs to have a size, yeah
z
sorry, I am not understanding. Is that
actualHeight
at the end the actual height of the composable or the height of the expanded touch area?
278 Views