Hi everyone Is <DropdownMenu> available in compose...
# compose-desktop
a
Hi everyone Is DropdownMenu available in compose desktop? I tried to import (
androidx.compose.material.DropdownMenu
) it but the IDE can’t find it. I’m using version
0.3.2
of compose
j
Yes, it looks like it should be available, but it looks like both Android and Desktop provide platform-specific implementations (as oppose to a single
common
using expect/actual). The thing that comes to mind is that maybe you're trying to access it from common code instead of from
desktopMain
?
j
But
expect
is not viable in common code? If I want to use it in common code, I have to manually create the expect/actual?
j
Correct, I don't see an
expect
for DropdownMenu.
Note that although we don't provide our own
common
expect/actual, you could easily write your own common expect/actual that delegates to the platform-specific implementations, which would then allow you to use it from common code.
IIRC, the reason we don't provide our own expect-actual is that there are some additional properties for the Android dropdown, and it wasn't clear what the defaults should be for a given person's app, and we didn't want those to properties leak into the common API. We have a couple of ideas for fixes longer term, but they required more work than we were willing/able to do before beta, so we decided to not add a common API that we couldn't commit to, with the expectation that we would add one in the future. At least, that was the story behind dialog IIRC, and I'm pretty sure the same was true for dropdown for the same reasons. IIRC, dialog is the other widget where you need to bring your own common expect.
👍 2
@albertosh Does that information unblock you? Or are you still having issues getting it to import?
a
Hi Jim Thanks for the answer. You’re totally right, I was trying to use it from the
common
module and it’s available in the desktop one It’s not really a blocker, I’m just playing around with compose desktop to get some hands on experience out of mobile environment 🙂
👍 1
j
Thank you for the clarification :)
👍 1