notDmDrl / pull_down_button

A package that implements Pull-Down Button from iOS 14 in Flutter. Highly customizable.
https://pub.dev/packages/pull_down_button
MIT License
95 stars 32 forks source link

[Feature Request] Nested sub-menus #26

Open umar-stride-studio opened 1 year ago

umar-stride-studio commented 1 year ago

I want to implement something like this in flutter application

IMG_1419

IMG_1420

You can see when user click on sort by button another menu appeared on previous menu. I want to implement same functionality. Let me know if it is possible. If not then any alternative for it?

umar-stride-studio commented 1 year ago

@iSa1vatore @notDmDrl

notDmDrl commented 1 year ago

Hi @umar-stride-studio

This is yet to be implemented, so no, this is not possible.

I don't have any estimates on when this will become available since, as seen in https://github.com/flutter/flutter/issues/120960, in https://github.com/flutter/flutter/issues/60298#issuecomment-1483754218 and https://github.com/flutter/flutter/issues/60298#issuecomment-1513586626, @davidhicks980 is working on it already and plans to submit a PR (whether it will be to this repo, Flutter or his package).

I want to wait on said PR so there is no redundant work done by me 😃

If PR ends up here, it will be released ASAP. If not, I'll begin to work on my implementation.

As for an alternative, either separate the submenu to its own PullDownButton or inline it in an existing one.


Sorry for the ping @davidhicks980 :slightly_smiling_face:

davidhicks980 commented 1 year ago

No worries! I'm actually on vacation and working on this at the moment. To accommodate the expansion panel, I had to change the API surface a bit, so I will attempt a draft PR in the Flutter repo, but, if some of the more sophisticated features like expansion get rejected in the main repo (I imagine some will because of the testing complexity), I was planning on submitting pull requests here for anyone who wants more feature parity. Also -- off topic -- thank you for the continuous swipe idea! I added it to the nested menus. It's a bit hard to tell because I'm using my mouse in the video, but I don't mouseup at all while on the menu.

I think I will have a draft PR in the main repo by Monday, supposing no road blocks come up. Flutter's popup menus have quite a few tests, so we will see. I'll be sure to tag you once it is live.

https://github.com/notDmDrl/pull_down_button/assets/59215665/44af3dd6-819f-49f0-9ed9-a5334e0415fe

https://github.com/notDmDrl/pull_down_button/assets/59215665/2f3c93d0-bd4f-4fad-ad4c-6ec9b4e2da41

umar-stride-studio commented 1 year ago

@davidhicks980 when i will get an update regarding this feature. Actually I have some urgency to deliver the project

umar-stride-studio commented 1 year ago

@notDmDrl @davidhicks980 any update?

davidhicks980 commented 1 year ago

I'm still testing, but if you don't mind not having a full suite of tests, I'll put the repo on GitHub today. For anyone stumbling across this comment, I don't want people using my menu impl over @notDmDrl for production use, because that'll fragment the ecosystem (plus @notDmDrl's is more customizable and better documented). Mine is purely to propose to the Flutter team. Be warned -- it's still changing and you'll have to use the example to guide you.

davidhicks980 commented 1 year ago

https://github.com/davidhicks980/cupertino_menu I had to remove the nested menu navigation temporarily and there are some styling issues, but I think the example should provide some guidance on how to implement.

alterhuman commented 1 year ago

Hey @notDmDrl, is there a plan to merge the solution provided by @davidhicks980 with this repo?

notDmDrl commented 1 year ago

Hi @alterhuman

Both solutions (mine and David's) are pretty different in structure and internal API design, so it will be a rather non-trivial task to merge his solution to this repo.

Unfortunately, due to some IRL stuff, I will not be able to work on my implementation for a few months so if anyone wants to give this issue a try and submit a PR it would be nice 😃

davidhicks980 commented 1 year ago

@notDmDrl @alterhuman Same with IRL stuff, but I'm actually about to have a lot less to do, so I may be able to rework it into this repo. Nested menus pose a lot of challenges, particularly with regard to things like hovering sliding, communicating between layers, and responding to layout changes between layers. If I'm remembering correctly, I think the repo I shared used a nested navigator approach, which is probably not the best way to do it. You can use nested overlays, but tracking changes between layers is difficult. CompositedTransformFollower has it's own tradeoffs. As far as I can tell, Flutter doesn't provides a great api for working with nested overlays because layers really shouldn't affect each other (i.e. single pass), so I've been meaning to shift to a multi child layout. As this is meant to be full-match Flutter's way of doing things (@notDmDrl gives a lot more customization options than the Cupertino theme does), the repo I shared doesn't neatly slot in to this repo. That being said, once I have a solid approach, an actual migration shouldn't be too tough.

Long story short -- on the way, but I've been busy with work and life.

manudicri commented 2 months ago

Hi, any news on this? That could be really awesome

davidhicks980 commented 2 months ago

Dang it's been a year. This turned into a bigger project to change some of flutters internal menus, including producing a raw menu anchor for the flutter repo. So it's been slow but moving along. Some of the changes have already landed, but the Cupertino menu is still in the queue.