Can you recommend an API / approach to have a widg...
# compose
d
Can you recommend an API / approach to have a widget expand outside of its boundaries? I'll try to clarify my question with an example: picture a Button that when clicked is expanded into N other buttons that radiate out of it. Ideally the widget just take the space for the original button and doesn't change in size for what concern the outside container. I know that I can use
Modifier.offset
but I was wondering if there was a way to define the expanded state as a regular composable instead of having each satellite-button on top of each other and offsetting them outwards with
Modifier.offset
. I'm not trying to realize this widget, I'm just looking into learning if there is some way of achieving this "escape boundaries" behavior and if yes how. Thank you
a
Modifier.wrapContentSize(unbounded = true)
d
unbounded let me go past the
maxSize
provided from outside but it still change the size of the widget from outside
a
Of course you need some kind of placeholder to take the space the original content took, otherwise how would the layout knows what the size was?
d
I want the widget to be if size 48x48dp but draw in a 128x128dp area (example numbers)
a
Then you can just use
Copy code
Modifier
    .size(48.dp)
    .wrapContentSize(unbounded = true)
    .size(128.dp)
d
say expanded state is 4x the actual widget size. from outside the widget doesn't change in size when it expand -kind-of-thing
oh right, I didn't think of that, in a box I can use
Copy code
Modifier.matchParentSize()
      .wrapContentSize(unbounded = true)
thanks