fujidaiti / smooth_sheets

Sheet widgets with smooth motion and great flexibility.
https://pub.dev/packages/smooth_sheets
MIT License
233 stars 22 forks source link

ModalSheetPage with DraggableNavigationSheetPage/ScrollableNavigationSheetPage Pop animation #272

Open Clon1998 opened 1 month ago

Clon1998 commented 1 month ago

I have implemented bottom sheet navigation similar to the one used in the AI Playlist Generator. I have a ShellRoute that returns a ModalSheetPage within the ShellRoute.pageBuilder method. The routes in the Shell are either DraggableNavigationSheetPage or ScrollableNavigationSheetPage.

The navigation works well, and I can have nicely animated transitions when opening Sheet-A and then pushing Sheet-B. Popping Sheet-B also transitions smoothly back. However, if I add a close button on Sheet-A to pop Sheet-A, both the transition animation and the ModalSheetPage animation play, resulting in a strange closing animation.

On the other hand, if I tap the barrier, only the animation of the ModalSheetPage plays, and Sheet-A remains visible.

Is there a way to ensure that the transition animation is not used when popping the last sheet in a ShellRoute so that only the "slide-down" animation of the modal sheet is used?

Here is an example of recoding. Due to the platform, it uses the "Slide" transition, which looks weird when closing the sheet:

https://github.com/user-attachments/assets/068048fe-f16d-4000-b3f8-5dc81c29d36c

Clon1998 commented 1 month ago

As I am using GoRouter with Shell routes I realized there I can just use GoRouter.of rather than Navigator.of which just shows the modal close animation