Skip to content

Conversation

@ShashankSMayya
Copy link

Description

This pull request introduces a new widget, ScrollDragDismissable, which enables drag-to-dismiss functionality for scrollable content, similar to bottom sheet behavior. The implementation integrates this widget into the example app to enhance user interaction, and updates the package exports and dependencies accordingly.

New drag-to-dismiss functionality for scrollable content:

  • Added the new ScrollDragDismissable widget in scroll_drag_dismissable.dart, which allows scrollable widgets to be dismissed by dragging, handling gesture transitions between scrolling and dismissal, and integrating with HeroineVelocity for smooth transitions.
  • Exported ScrollDragDismissable from the package in heroine.dart for public use.
  • Added the scroll_drag_detector dependency to support gesture detection for the new widget.

Integration into example app:

  • Updated the SecondDetailsPage in the example to use a scrollable ListView instead of a static Center widget, providing a better demonstration of scrollable drag-to-dismiss.
  • Replaced DragDismissable with ScrollDragDismissable in the example's custom route, disabling scrollableCanMoveBack to match the intended UX.

Checklist

  • My PR title is in the style of conventional commits
  • All public facing APIs are documented with dartdoc
  • I have added tests to cover my changes

@timcreatedit
Copy link
Contributor

Dude this is amazing, I've had this on my to do list! I hope I find time to test this out this week 🤩

Copy link
Contributor

@timcreatedit timcreatedit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this! I only have two small comments, but otherwise LGTM! If possible, I'd love one or two tests on this, but no pressure, we can add them later

/// Set this to false when your scrollable cannot move backwards (e.g. a
/// sheet is fully expanded) to allow this child's scrollable to transition
/// back to scrolling instead of dragging.
final bool scrollableCanMoveBack;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This parameter should probably not be exposed. Instead we should set it based on the current dismiss progress. If dismiss progress is 0, the scrollable can't move further back, but if it is > 0 it can

flutter:
sdk: flutter
motor: ^1.0.1
scroll_drag_detector: ^0.0.4
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you update this to the latest dependency?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's also the reason the CI seems to be failing :)

@timcreatedit
Copy link
Contributor

hey @ShashankSMayya! Would you mind if I finish this up? Or do you have some time? I actually really love the idea and would kind of need it in one of my own projects

@ShashankSMayya
Copy link
Author

Hey, I don't mind if you do it too. If not, I'll check it over this weekend if that works. I've been a bit busy last few weeks, sorry for the delay.

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