Material Bottom Sheet Reveal/Dismiss animation uses a curved animation#51122
Material Bottom Sheet Reveal/Dismiss animation uses a curved animation#51122fluttergithubbot merged 21 commits intoflutter:masterfrom guidezpl:bottom-sheet-curve
Conversation
…om-sheet-curve
perclasson
left a comment
There was a problem hiding this comment.
Some style nits and comments
…om-sheet-curve
rami-a
left a comment
There was a problem hiding this comment.
LGTM with a couple comments
|
@guidezpl the analyzer is unhappy about this: |
| final bool enableDrag; | ||
|
|
||
| /// Called when the user begins dragging the bottom sheet vertically. | ||
| final BottomSheetDragStartHandler onDragStart; |
There was a problem hiding this comment.
The new callbacks should explain how they'd typically be used and how they relate to the existing onClosing and enableDrag parameters.
| /// straight line, and the top-right quarter will contain the entire contents of | ||
| /// [Curves.easeOut]. | ||
| /// | ||
| /// This is useful in situations where a widget must track the user's finger |
There was a problem hiding this comment.
This curve appears to fit a common idiom - linear drag then cuved animated fling - that's not specific to BottomSheet. Rather than defining it as specific to BottomSheet now, and then later as a generic utility with a different name, can we keep the API private for now and then make it public later? We'd have to include a copy of _BottomSheetSuspendedCurve in scaffold.dart for now. Making this public would require adding some usage examples to the docs and maybe retrofitting some existing code to use it (and to prove that it's generally useful).
There was a problem hiding this comment.
I don't mind adding examples and putting it in material/curves.dart. I think this would be cleaner and a future PR could use it in more places that exhibit this kind of behaviour. What do you think?
There was a problem hiding this comment.
I think that expanding on this part of the PR, by adding a track-fling curve and some examples to curves.dart in a future PR, is a good idea. So long as the curve is (the two copies of the curve are) private now.
Description
Ensures all bottom sheets use non-linear animations for entrance and exits, while still allowing dragging (linearly) bottom sheets. Fixes the animation durations to match the spec.
Before (in slow motion):

After (in slow motion):1

Related Issues
Closes #19469
Future work #51627
Tests
I added the following tests:
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.///).flutter analyze --flutter-repo) does not report any problems on my PR.Breaking Change
Did any tests fail when you ran them? Please read Handling breaking changes.