Skip to content

Conversation

dnfield
Copy link
Contributor

@dnfield dnfield commented Apr 30, 2019

Description

A DraggableScrollableSheet whose children will never fill its full available child height today will get "stuck" when dragged up to the full available extent of the children in the list. This is because the scroll position ends up thinking it doesn't have any extent left to give. This PR adds to the available min/max extent if we're not actually at min/max extent.

This results in the following behavior:

  • If a child list is at its "natural" max extent, it will continue to get dragged up until it reaches the parent's max extent. It can be dragged down as well. It will never actually scroll its contents.

While working on this, I also noticed that setting the maxChildSize to < 1.0 will make the dragging not "stick" to the finger. This contains a fix for that - I'd split it out but then I'd have a weird merge conflict for the tests.

Related Issues

Fixes #31739

Tests

New test to cover this scenario (smaller sized list can still be dragged up and down and doesn't get stuck).

New tests to check where the top of the container ends up when dragging for some values of maxChildSize.

Checklist

Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]). This will ensure a smooth and quick review process.

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I signed the CLA.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I updated/added relevant documentation (doc comments with ///).
  • All existing and new tests are passing.
  • The analyzer (flutter analyze --flutter-repo) does not report any problems on my PR.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Does your PR require Flutter developers to manually update their apps to accommodate your change?

  • Yes, this is a breaking change (Please read Handling breaking changes). Replace this with a link to the e-mail where you asked for input on this proposed change.
  • No, this is not a breaking change.

@dnfield dnfield added framework flutter/packages/flutter repository. See also f: labels. f: scrolling Viewports, list views, slivers, etc. labels Apr 30, 2019
Copy link
Contributor

@HansMuller HansMuller left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -280,9 +280,6 @@ class _DraggableSheetExtent {
context: context,
).dispatch(context);
}

@override
Copy link
Contributor

Choose a reason for hiding this comment

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

Why remove this? Maybe it wasn't helpful?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I used it for testing at one point and accidentally committed it. I'm not sure it's exposing the right params in the right order to be helpful for anything but the local test I was doing.

@dnfield dnfield merged commit 4bc35fc into flutter:master Apr 30, 2019
@dnfield dnfield deleted the drag_scroll_fix branch April 30, 2019 22:42
@arefay
Copy link

arefay commented Jun 29, 2019

Is there a way to programmatically reset the DraggableScrollableSheet to its original state? I've looked a DraggableScrollableActuator but I'm not sure how to implement the reset via a click.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
f: scrolling Viewports, list views, slivers, etc. framework flutter/packages/flutter repository. See also f: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DraggableScrollableSheet gets stuck and won't move
4 participants