diff --git a/sky/packages/sky/lib/src/gestures/drag.dart b/sky/packages/sky/lib/src/gestures/drag.dart index f0c3a2c0141..602d9be7b14 100644 --- a/sky/packages/sky/lib/src/gestures/drag.dart +++ b/sky/packages/sky/lib/src/gestures/drag.dart @@ -15,11 +15,11 @@ enum DragState { accepted } -typedef void GestureDragStartCallback(); +typedef void GestureDragStartCallback(ui.Point globalPosition); typedef void GestureDragUpdateCallback(double delta); typedef void GestureDragEndCallback(ui.Offset velocity); -typedef void GesturePanStartCallback(); +typedef void GesturePanStartCallback(ui.Point globalPosition); typedef void GesturePanUpdateCallback(ui.Offset delta); typedef void GesturePanEndCallback(ui.Offset velocity); @@ -43,6 +43,7 @@ abstract class _DragGestureRecognizer extends GestureRecogniz GestureDragEndCallback onEnd; DragState _state = DragState.ready; + ui.Point _initialPosition; T _pendingDragDelta; T get _initialPendingDragDelta; @@ -56,6 +57,7 @@ abstract class _DragGestureRecognizer extends GestureRecogniz _velocityTrackers[event.pointer] = new ui.VelocityTracker(); if (_state == DragState.ready) { _state = DragState.possible; + _initialPosition = event.position; _pendingDragDelta = _initialPendingDragDelta; } } @@ -85,7 +87,7 @@ abstract class _DragGestureRecognizer extends GestureRecogniz T delta = _pendingDragDelta; _pendingDragDelta = _initialPendingDragDelta; if (onStart != null) - onStart(); + onStart(_initialPosition); if (delta != _initialPendingDragDelta && onUpdate != null) onUpdate(delta); } diff --git a/sky/packages/sky/lib/src/material/drawer.dart b/sky/packages/sky/lib/src/material/drawer.dart index bfc7796ac1d..f6ddba64c42 100644 --- a/sky/packages/sky/lib/src/material/drawer.dart +++ b/sky/packages/sky/lib/src/material/drawer.dart @@ -49,7 +49,7 @@ class _Drawer extends StatelessComponent { Widget build(BuildContext context) { return new GestureDetector( - onHorizontalDragStart: () { + onHorizontalDragStart: (_) { if (interactive) route._takeControl(); }, diff --git a/sky/packages/sky/lib/src/widgets/dismissable.dart b/sky/packages/sky/lib/src/widgets/dismissable.dart index d4f120ba3e2..4b294cbc4e9 100644 --- a/sky/packages/sky/lib/src/widgets/dismissable.dart +++ b/sky/packages/sky/lib/src/widgets/dismissable.dart @@ -115,7 +115,7 @@ class _DismissableState extends State { _maybeCallOnResized(); } - void _handleDragStart() { + void _handleDragStart(_) { if (_fadePerformance.isAnimating) return; setState(() { diff --git a/sky/packages/sky/lib/src/widgets/scrollable.dart b/sky/packages/sky/lib/src/widgets/scrollable.dart index 43b5766b7ce..508a5633b46 100644 --- a/sky/packages/sky/lib/src/widgets/scrollable.dart +++ b/sky/packages/sky/lib/src/widgets/scrollable.dart @@ -239,7 +239,7 @@ abstract class ScrollableState extends State { _animation.stop(); } - void _handleDragStart() { + void _handleDragStart(_) { scheduleMicrotask(dispatchOnScrollStart); } diff --git a/sky/unit/test/gestures/scroll_test.dart b/sky/unit/test/gestures/scroll_test.dart index 09a6ccd72d8..9c1c0492169 100644 --- a/sky/unit/test/gestures/scroll_test.dart +++ b/sky/unit/test/gestures/scroll_test.dart @@ -12,7 +12,7 @@ void main() { TapGestureRecognizer tap = new TapGestureRecognizer(router: router); bool didStartPan = false; - pan.onStart = () { + pan.onStart = (_) { didStartPan = true; }; diff --git a/sky/unit/test/widget/gesture_detector_test.dart b/sky/unit/test/widget/gesture_detector_test.dart index 56cd9b337e3..56f9bdecf22 100644 --- a/sky/unit/test/widget/gesture_detector_test.dart +++ b/sky/unit/test/widget/gesture_detector_test.dart @@ -14,7 +14,7 @@ void main() { bool didEndDrag = false; Widget widget = new GestureDetector( - onVerticalDragStart: () { + onVerticalDragStart: (_) { didStartDrag = true; }, onVerticalDragUpdate: (double scrollDelta) { @@ -97,7 +97,7 @@ void main() { tester.pumpWidget( new GestureDetector( - onPanStart: () { + onPanStart: (_) { didStartPan = true; }, onPanUpdate: (Offset delta) {