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
75061728
Commit
75061728
authored
Sep 25, 2015
by
Andrew Wilson
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1342 from apwilson/fling
Add fling to Scrollable.
parents
96b0801c
d7719272
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
6 deletions
+10
-6
scrollable.dart
packages/flutter/lib/src/widgets/scrollable.dart
+10
-6
No files found.
packages/flutter/lib/src/widgets/scrollable.dart
View file @
75061728
...
...
@@ -163,6 +163,14 @@ abstract class Scrollable extends StatefulComponent {
return
scrollTo
(
newScrollOffset
,
duration:
duration
,
curve:
curve
);
}
void
fling
(
Offset
velocity
)
{
if
(
velocity
!=
Offset
.
zero
)
{
_startToEndAnimation
(
velocity:
_scrollVelocity
(
velocity
));
}
else
if
(!
_toEndAnimation
.
isAnimating
&&
(
_toOffsetAnimation
==
null
||
!
_toOffsetAnimation
.
isAnimating
))
{
settleScrollOffset
();
}
}
void
settleScrollOffset
()
{
_startToEndAnimation
();
}
...
...
@@ -185,11 +193,7 @@ abstract class Scrollable extends StatefulComponent {
}
void
_handleDragEnd
(
Offset
velocity
)
{
if
(
velocity
!=
Offset
.
zero
)
{
_startToEndAnimation
(
velocity:
_scrollVelocity
(
velocity
));
}
else
if
(!
_toEndAnimation
.
isAnimating
&&
(
_toOffsetAnimation
==
null
||
!
_toOffsetAnimation
.
isAnimating
))
{
settleScrollOffset
();
}
fling
(
velocity
);
}
final
List
<
ScrollListener
>
_listeners
=
new
List
<
ScrollListener
>();
...
...
@@ -566,7 +570,7 @@ class PageableList<T> extends ScrollableList<T> {
.
clamp
(
scrollBehavior
.
minScrollOffset
,
scrollBehavior
.
maxScrollOffset
);
}
void
_handleDragEnd
(
sky
.
Offset
velocity
)
{
void
fling
(
sky
.
Offset
velocity
)
{
double
scrollVelocity
=
_scrollVelocity
(
velocity
);
double
newScrollOffset
=
_snapScrollOffset
(
scrollOffset
+
scrollVelocity
.
sign
*
itemExtent
)
.
clamp
(
_snapScrollOffset
(
scrollOffset
-
itemExtent
/
2.0
),
...
...
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