Skip to content

Add menuSpacing parameter for adding space between the button and the menu#75

Open
rasitayaz wants to merge 5 commits into
notDmDrl:mainfrom
rasitayaz:main
Open

Add menuSpacing parameter for adding space between the button and the menu#75
rasitayaz wants to merge 5 commits into
notDmDrl:mainfrom
rasitayaz:main

Conversation

@rasitayaz
Copy link
Copy Markdown

@rasitayaz rasitayaz commented Sep 11, 2025

Example:

PullDownButton(
  menuSpacing: 8,
  ...
)

Maybe we can rename it to something like menuDistance lmk if you propose any changes.

@rasitayaz rasitayaz changed the title Add menuSpacing parameter to add space between the button and the menu Add menuSpacing parameter for adding space between the button and the menu Sep 11, 2025
@notDmDrl
Copy link
Copy Markdown
Owner

Hi @rasitayaz

This does make sense as a feature. However, I am not sold on the idea of two separate parameters for vertical and horizontal spacing.

I think it might be better to introduce a breaking change and change menuOffset to be Offset instead of double. This way, we cover both vertical and horizontal offsets of the menu.

It should be fine since the 1.0.0 release already has breaking changes, and I doubt menuOffset was used that much to cause a lot of trouble.

@rasitayaz
Copy link
Copy Markdown
Author

You're right, two parameters would complicate things. But wouldn't using an Offset cause issues with vertical positioning? For example, if the menu is shown above the button, vertical offset should be negative to give some spacing; and if it's below the button, it should be positive. I think using a Padding would be a better idea in that case.

@notDmDrl
Copy link
Copy Markdown
Owner

notDmDrl commented Nov 1, 2025

For example, if the menu is shown above the button, vertical offset should be negative to give some spacing; and if it's below the button, it should be positive.

I see what you mean. In this case, yes, I agree, Offset might not be a good fit.

In this case, I see two ways:

  • Bite the bullet and add a new parameter with assert to only non-negative numbers (that will automatically update vertical offset based on where the menu is shown).
  • Switch to Offset and leave the choice for positioning to the user, even if it is arguably a bad choice.

I'd say the first option is better, but with a better naming to reflect that it is only vertical spacing, maybe menuVerticalOffset or verticalOffsetFromButton (this one is a bit too long for my liking, but also is pretty clear in its purpose)

@rasitayaz
Copy link
Copy Markdown
Author

Or we could use a padding parameter with EdgeInsetsGeometry type. Would be very intuitive for both horizontal and vertical spacing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants