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
a78ad92d
Commit
a78ad92d
authored
Sep 14, 2016
by
Hans Muller
Committed by
GitHub
Sep 14, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Small revision to ScrollableState.fling() (#5871)
parent
1ba15622
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
2 deletions
+12
-2
scrollable.dart
packages/flutter/lib/src/widgets/scrollable.dart
+12
-2
No files found.
packages/flutter/lib/src/widgets/scrollable.dart
View file @
a78ad92d
...
@@ -511,14 +511,24 @@ class ScrollableState<T extends Scrollable> extends State<T> {
...
@@ -511,14 +511,24 @@ class ScrollableState<T extends Scrollable> extends State<T> {
updateGestureDetector
();
updateGestureDetector
();
}
}
/// Fling the scroll offset with the given velocity in logical pixels/second.
/// If [scrollVelocity] is greater than [PixelScrollTolerance.velocity] then
/// fling the scroll offset with the given velocity in logical pixels/second.
/// Otherwise, if this scrollable is overscrolled or a [snapOffsetCallback]
/// was given, animate the scroll offset to its final value with [settleScrollOffset].
///
///
/// Calling this function starts a physics-based animation of the scroll
/// Calling this function starts a physics-based animation of the scroll
/// offset with the given value as the initial velocity. The physics
/// offset with the given value as the initial velocity. The physics
/// simulation is determined by the scroll behavior.
/// simulation is determined by the scroll behavior.
Future
<
Null
>
fling
(
double
scrollVelocity
)
{
Future
<
Null
>
fling
(
double
scrollVelocity
)
{
if
(
scrollVelocity
.
abs
()
>
kPixelScrollTolerance
.
velocity
||
!
_controller
.
isAnimating
)
if
(
scrollVelocity
.
abs
()
>
kPixelScrollTolerance
.
velocity
)
return
_startToEndAnimation
(
scrollVelocity
);
return
_startToEndAnimation
(
scrollVelocity
);
// If a scroll animation isn't underway already and we're overscrolled or we're
// going to have to snap the scroll offset, then animate the scroll offset to its
// final value.
if
(!
_controller
.
isAnimating
&&
(
shouldSnapScrollOffset
||
!
_scrollOffsetIsInBounds
(
scrollOffset
)))
return
settleScrollOffset
();
return
new
Future
<
Null
>.
value
();
return
new
Future
<
Null
>.
value
();
}
}
...
...
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