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
bcf08d23
Commit
bcf08d23
authored
Mar 22, 2016
by
Hans Muller
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2829 from HansMuller/super_fling_fast
Fix Fast Fling Failure
parents
fb427a1e
1af58aee
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
8 deletions
+10
-8
constants.dart
packages/flutter/lib/src/gestures/constants.dart
+2
-2
drag.dart
packages/flutter/lib/src/gestures/drag.dart
+7
-4
scrollable.dart
packages/flutter/lib/src/widgets/scrollable.dart
+1
-2
No files found.
packages/flutter/lib/src/gestures/constants.dart
View file @
bcf08d23
...
...
@@ -78,9 +78,9 @@ const double kWindowTouchSlop = 16.0; // Logical pixels
/// gesture.
// TODO(ianh): Make sure nobody has their own version of this.
const
double
kMinFlingVelocity
=
50.0
;
// Logical pixels / second
// const Velocity kMinFlingVelocity = const Velocity(pixelsPerSecond: 50.0);
/// The maximum velocity of a touch to consider that touch to trigger a fling
/// gesture.
/// Drag gesture fling velocities are clipped to this value.
// TODO(ianh): Make sure nobody has their own version of this.
const
double
kMaxFlingVelocity
=
8000.0
;
// Logical pixels / second
...
...
packages/flutter/lib/src/gestures/drag.dart
View file @
bcf08d23
...
...
@@ -31,8 +31,7 @@ typedef void _GesturePolymorphicUpdateCallback<T>(T delta);
bool
_isFlingGesture
(
Velocity
velocity
)
{
assert
(
velocity
!=
null
);
final
double
speedSquared
=
velocity
.
pixelsPerSecond
.
distanceSquared
;
return
speedSquared
>
kMinFlingVelocity
*
kMinFlingVelocity
&&
speedSquared
<
kMaxFlingVelocity
*
kMaxFlingVelocity
;
return
speedSquared
>
kMinFlingVelocity
*
kMinFlingVelocity
;
}
abstract
class
_DragGestureRecognizer
<
T
extends
dynamic
>
extends
OneSequenceGestureRecognizer
{
...
...
@@ -119,10 +118,14 @@ abstract class _DragGestureRecognizer<T extends dynamic> extends OneSequenceGest
assert
(
tracker
!=
null
);
Velocity
velocity
=
tracker
.
getVelocity
();
if
(
velocity
!=
null
&&
_isFlingGesture
(
velocity
))
if
(
velocity
!=
null
&&
_isFlingGesture
(
velocity
))
{
final
Offset
pixelsPerSecond
=
velocity
.
pixelsPerSecond
;
if
(
pixelsPerSecond
.
distanceSquared
>
kMaxFlingVelocity
*
kMaxFlingVelocity
)
velocity
=
new
Velocity
(
pixelsPerSecond:
(
pixelsPerSecond
/
pixelsPerSecond
.
distance
)
*
kMaxFlingVelocity
);
onEnd
(
velocity
);
else
}
else
{
onEnd
(
Velocity
.
zero
);
}
}
_velocityTrackers
.
clear
();
}
...
...
packages/flutter/lib/src/widgets/scrollable.dart
View file @
bcf08d23
...
...
@@ -499,8 +499,7 @@ abstract class ScrollableState<T extends Scrollable> extends State<T> {
Future
<
Null
>
_handleDragEnd
(
Velocity
velocity
)
{
double
scrollVelocity
=
pixelDeltaToScrollOffset
(
velocity
.
pixelsPerSecond
)
/
Duration
.
MILLISECONDS_PER_SECOND
;
// The gesture velocity properties are pixels/second, config min,max limits are pixels/ms
return
fling
(
scrollVelocity
.
clamp
(-
kMaxFlingVelocity
,
kMaxFlingVelocity
)).
then
(
_endScroll
);
return
fling
(
scrollVelocity
).
then
(
_endScroll
);
}
Null
_endScroll
([
Null
_
])
{
...
...
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