Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
1e446ffc
Commit
1e446ffc
authored
Oct 27, 2015
by
Adam Barth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add the position at which drags start
Fixes #1807
parent
dc636679
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
11 additions
and
9 deletions
+11
-9
drag.dart
packages/flutter/lib/src/gestures/drag.dart
+5
-3
drawer.dart
packages/flutter/lib/src/material/drawer.dart
+1
-1
dismissable.dart
packages/flutter/lib/src/widgets/dismissable.dart
+1
-1
scrollable.dart
packages/flutter/lib/src/widgets/scrollable.dart
+1
-1
scroll_test.dart
packages/unit/test/gestures/scroll_test.dart
+1
-1
gesture_detector_test.dart
packages/unit/test/widget/gesture_detector_test.dart
+2
-2
No files found.
packages/flutter/lib/src/gestures/drag.dart
View file @
1e446ffc
...
...
@@ -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<T extends dynamic> extends GestureRecogniz
GestureDragEndCallback
onEnd
;
DragState
_state
=
DragState
.
ready
;
ui
.
Point
_initialPosition
;
T
_pendingDragDelta
;
T
get
_initialPendingDragDelta
;
...
...
@@ -56,6 +57,7 @@ abstract class _DragGestureRecognizer<T extends dynamic> 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<T extends dynamic> extends GestureRecogniz
T
delta
=
_pendingDragDelta
;
_pendingDragDelta
=
_initialPendingDragDelta
;
if
(
onStart
!=
null
)
onStart
();
onStart
(
_initialPosition
);
if
(
delta
!=
_initialPendingDragDelta
&&
onUpdate
!=
null
)
onUpdate
(
delta
);
}
...
...
packages/flutter/lib/src/material/drawer.dart
View file @
1e446ffc
...
...
@@ -49,7 +49,7 @@ class _Drawer extends StatelessComponent {
Widget
build
(
BuildContext
context
)
{
return
new
GestureDetector
(
onHorizontalDragStart:
()
{
onHorizontalDragStart:
(
_
)
{
if
(
interactive
)
route
.
_takeControl
();
},
...
...
packages/flutter/lib/src/widgets/dismissable.dart
View file @
1e446ffc
...
...
@@ -115,7 +115,7 @@ class _DismissableState extends State<Dismissable> {
_maybeCallOnResized
();
}
void
_handleDragStart
()
{
void
_handleDragStart
(
_
)
{
if
(
_fadePerformance
.
isAnimating
)
return
;
setState
(()
{
...
...
packages/flutter/lib/src/widgets/scrollable.dart
View file @
1e446ffc
...
...
@@ -239,7 +239,7 @@ abstract class ScrollableState<T extends Scrollable> extends State<T> {
_animation
.
stop
();
}
void
_handleDragStart
()
{
void
_handleDragStart
(
_
)
{
scheduleMicrotask
(
dispatchOnScrollStart
);
}
...
...
packages/unit/test/gestures/scroll_test.dart
View file @
1e446ffc
...
...
@@ -12,7 +12,7 @@ void main() {
TapGestureRecognizer
tap
=
new
TapGestureRecognizer
(
router:
router
);
bool
didStartPan
=
false
;
pan
.
onStart
=
()
{
pan
.
onStart
=
(
_
)
{
didStartPan
=
true
;
};
...
...
packages/unit/test/widget/gesture_detector_test.dart
View file @
1e446ffc
...
...
@@ -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
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment