Fold fling gesture into onDragEnd

That way the fling engages in the same direction as the scroll. For example, if
you have a horizontal scroll nested inside a vertical scroll, the fling will
take place in the same direction as the scroll.
This commit is contained in:
Adam Barth
2015-09-10 12:38:11 -07:00
parent d76f5652e6
commit 63101e49bc
8 changed files with 48 additions and 116 deletions

View File

@@ -25,7 +25,7 @@ void main() {
};
bool didEndPan = false;
pan.onEnd = () {
pan.onEnd = (sky.Offset velocity) {
didEndPan = true;
};

View File

@@ -21,7 +21,7 @@ void main() {
onVerticalDragUpdate: (double scrollDelta) {
updatedDragDelta = scrollDelta;
},
onVerticalDragEnd: () {
onVerticalDragEnd: (Offset velocity) {
didEndDrag = true;
},
child: new Container()
@@ -69,9 +69,9 @@ void main() {
Widget builder() {
return new GestureDetector(
onVerticalDragUpdate: (double delta) { dragDistance += delta; },
onVerticalDragEnd: () { gestureCount += 1; },
onVerticalDragEnd: (Offset velocity) { gestureCount += 1; },
onHorizontalDragUpdate: (_) { fail("gesture should not match"); },
onHorizontalDragEnd: () { fail("gesture should not match"); },
onHorizontalDragEnd: (Offset velocity) { fail("gesture should not match"); },
child: new Container()
);
}