Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request for Dropdown Menu Auto-Close Feature on Screen Size Change #326

Open
NaderMohamedMusa opened this issue Oct 13, 2024 · 3 comments
Open
Labels
question Further information is requested

Comments

@NaderMohamedMusa
Copy link

Hi Ahmed,

I've encountered an issue in our Flutter web project while using the DropdownButtonFormField2 package. Specifically, I need the dropdown menu to automatically close when the screen size changes. Currently, this behavior is not supported by the package.

I implemented a temporary workaround using WidgetsBindingObserver to detect screen size changes and close the menu manually via Navigator.of(context).pop(). However, it would be more efficient if this feature were supported natively by the package.

I've drafted a request to raise this issue with the package maintainer and included the relevant code. If you agree, I can proceed with contacting the maintainer.

Looking forward to your feedback.
dropDownButton2_issues.txt

Thanks!

@AhmedLSayed9
Copy link
Owner

The common practice for dropdown menus in web is to remain open until the user interacts with them (e.g., by clicking outside the menu or choosing an option).

Auto closing the menu when the screen size changes can be disruptive to the user experience. Can you elaborate more why it is needed?

@AhmedLSayed9 AhmedLSayed9 added the question Further information is requested label Oct 13, 2024
@NaderMohamedMusa
Copy link
Author

Hello,

Thank you for your recent update. I noticed that the latest beta version of the package has resolved some of the issues I was facing with dropdown functionality. However, I would like to suggest adding a field or property that controls whether the dropdown menu should remain open or close when the web screen size changes.

This feature would provide more flexibility for developers working on responsive web applications, allowing them to manage dropdown visibility effectively without needing to implement custom listeners.

Please let me know if this is something that can be considered in future releases.

Thank you for your continuous support and efforts!

@AhmedLSayed9
Copy link
Owner

Closing dropdown menu when the screen size changes is uncommon practice and can be opinionated.

i.e: a user may want it to close just when screen size changes and another user may want it to close at some breakpoints.
another example: a user may want it to close when keyboard opens, another user doesn't (using search dropdown).

Therefore, as this is uncommon practice and can be easily done by using Navigator.of(context).pop(), I don't think it's a good idea to implement it internally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants