akshathjain / sliding_up_panel

A draggable Flutter widget that makes implementing a SlidingUpPanel much easier!
https://pub.dartlang.org/packages/sliding_up_panel
Other
1.36k stars 377 forks source link

Panel's closing & draggable snapping #340

Open AdnanKhan45 opened 5 months ago

AdnanKhan45 commented 5 months ago

Hello there 👋

This is a very useful package that I found and utilize it in my open-source project Google Maps Clone, I find out this is an amazing custom panel which has a limited behaviour and this contribution contribute to it's behaviour and taking it a bit further by adding "Fully Closing Panel Behavior" & "Draggable Snapping Behaviour", these two features works under a boolean flag and do not disturb the existing functionality of the package.

How to use?

SlidingUpPanel(
 allowDraggableSnappingBehaviour: true // false,
 allowFullyPanelClosingBehaviour: true // false
)

I also liked to add some additional things to this amazing panel such as a resizeHandle and a method in the PanelController to open a panel at a desired position named showAt which operates the same as other methods in the PanelController.

You can add a resizeHandle like this:

SlidingUpPanel(
 resizeHandle: YourResizeHandleWidget()
)

You can open Panel at desired position like this:

PanelController.showAt(0.3); // ranges from 0.0 - 1.0

Currently the panel in my Google Maps Clone project might not exist if you're checking it now (24 Feb 2024) but will exist if you're in future 😄. Because this project is from a YouTube Bootcamp and changes reflects with a new video.

If you find out some of the functionality that I added is not working as expected please leave a comment or fix it and make a pull request.

Thanks.

AdnanKhan45 commented 5 months ago

https://github.com/akshathjain/sliding_up_panel/assets/71122083/424aadf7-70d8-4ebd-9179-41be7b11e2b2

https://github.com/akshathjain/sliding_up_panel/assets/71122083/8a260ac0-c935-41e1-a357-c2a79c190230

Here's what I've done. Please merge the pull request or let me know if something needs to be improved.