mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Merge pull request #633 from abarth/fling_sheet_up
Bottom sheets shouldn't dismiss when flung up
This commit is contained in:
commit
114135aadb
@ -52,12 +52,14 @@ class BottomSheet extends StatelessComponent {
|
||||
performance.progress -= delta / (childHeight ?? delta);
|
||||
}
|
||||
|
||||
void _handleDragEnd(Offset velocity, BuildContext context) {
|
||||
void _handleDragEnd(Offset velocity) {
|
||||
if (_dismissUnderway)
|
||||
return;
|
||||
if (velocity.dy > _kMinFlingVelocity) {
|
||||
performance.fling(velocity: -velocity.dy / childHeight);
|
||||
onClosing();
|
||||
double flingVelocity = -velocity.dy / childHeight;
|
||||
performance.fling(velocity: flingVelocity);
|
||||
if (flingVelocity < 0.0)
|
||||
onClosing();
|
||||
} else if (performance.progress < _kCloseProgressThreshold) {
|
||||
performance.fling(velocity: -1.0);
|
||||
onClosing();
|
||||
@ -69,7 +71,7 @@ class BottomSheet extends StatelessComponent {
|
||||
Widget build(BuildContext context) {
|
||||
return new GestureDetector(
|
||||
onVerticalDragUpdate: _handleDragUpdate,
|
||||
onVerticalDragEnd: (Offset velocity) { _handleDragEnd(velocity, context); },
|
||||
onVerticalDragEnd: _handleDragEnd,
|
||||
child: new Material(
|
||||
child: builder(context)
|
||||
)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user