Is there a replacement for `Spinner` yet?
# compose
d
Is there a replacement for
Spinner
yet?
j
DropDownMenu
d
Isn't that a replacement for the PopupMenu? Hmm, I suppose I could combine that with a Button.
j
Yes, for a spinner, use a Box where you put a Button and a DropDownMenu (so the menu is anchored correctly). With a correct toggle mechanism, this should give you a correct Spinner behaviour.
1
a
Hi @jaqxues, How do you make the DropDownMenu equal to the size of the parent?
j
Well since you already have a box around it, just tell DropDownMenu fillMaxWidth
a
Unfortunately it exceeds its box. Do you have some sample code I could look at. I maybe I'm missing something. In my understanding this is expected though as the DropDownItems are in a seperate window out and not in the same "plane" as its parent's Box.
d
You can probably use onSizeChanged to layout the width of the drop down? https://jetc.dev/slack/2021-02-14-how-big-are-we.html
a
Hi @David Edwards, I also did try that but onSizeChanged returns IntSize but size modifiers expects Dp. Would IntSize to Dp be fine?
d
Int probably represents the pixel size, so
.dp
would probably work in that case. Test and find out.
a
Alright thanks for the tip. Let me try it out.
Hi @David Edwards, it worked! Thanks for the tip!
🎉 1