Commit 114135aa authored by Adam Barth's avatar Adam Barth

Merge pull request #633 from abarth/fling_sheet_up

Bottom sheets shouldn't dismiss when flung up
parents 2f0e8eb1 7192dbb1
...@@ -52,12 +52,14 @@ class BottomSheet extends StatelessComponent { ...@@ -52,12 +52,14 @@ class BottomSheet extends StatelessComponent {
performance.progress -= delta / (childHeight ?? delta); performance.progress -= delta / (childHeight ?? delta);
} }
void _handleDragEnd(Offset velocity, BuildContext context) { void _handleDragEnd(Offset velocity) {
if (_dismissUnderway) if (_dismissUnderway)
return; return;
if (velocity.dy > _kMinFlingVelocity) { if (velocity.dy > _kMinFlingVelocity) {
performance.fling(velocity: -velocity.dy / childHeight); double flingVelocity = -velocity.dy / childHeight;
onClosing(); performance.fling(velocity: flingVelocity);
if (flingVelocity < 0.0)
onClosing();
} else if (performance.progress < _kCloseProgressThreshold) { } else if (performance.progress < _kCloseProgressThreshold) {
performance.fling(velocity: -1.0); performance.fling(velocity: -1.0);
onClosing(); onClosing();
...@@ -69,7 +71,7 @@ class BottomSheet extends StatelessComponent { ...@@ -69,7 +71,7 @@ class BottomSheet extends StatelessComponent {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new GestureDetector( return new GestureDetector(
onVerticalDragUpdate: _handleDragUpdate, onVerticalDragUpdate: _handleDragUpdate,
onVerticalDragEnd: (Offset velocity) { _handleDragEnd(velocity, context); }, onVerticalDragEnd: _handleDragEnd,
child: new Material( child: new Material(
child: builder(context) child: builder(context)
) )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment