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
81df765d
Commit
81df765d
authored
Feb 23, 2016
by
Ian Hickson
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2108 from Hixie/scroll
Clean up scroll behaviour.
parents
263e2e7f
98d47c35
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
7 deletions
+16
-7
scroll_behavior.dart
packages/flutter/lib/src/widgets/scroll_behavior.dart
+16
-7
No files found.
packages/flutter/lib/src/widgets/scroll_behavior.dart
View file @
81df765d
...
...
@@ -10,27 +10,36 @@ const double _kSecondsPerMillisecond = 1000.0;
const
double
_kScrollDrag
=
0.025
;
/// An interface for controlling the behavior of scrollable widgets.
abstract
class
ScrollBehavior
{
///
/// The type argument T is the type that describes the scroll offset.
/// The type argument U is the type that describes the scroll velocity.
abstract
class
ScrollBehavior
<
T
,
U
>
{
/// Returns a simulation that propels the scrollOffset.
///
/// This function is called when a drag gesture ends.
Simulation
createFlingScrollSimulation
(
double
position
,
double
velocity
)
=>
null
;
///
/// Returns null if the behavior is to do nothing.
Simulation
createFlingScrollSimulation
(
T
position
,
U
velocity
)
=>
null
;
/// Returns an animation that ends at the snap offset.
///
/// This function is called when a drag gesture ends and toSnapOffset is specified.
Simulation
createSnapScrollSimulation
(
double
startOffset
,
double
endOffset
,
double
startVelocity
,
double
endVelocity
)
=>
null
;
/// This function is called when a drag gesture ends and a
/// [SnapOffsetCallback] is specified for the scrollable.
///
/// Returns null if the behavior is to do nothing.
Simulation
createSnapScrollSimulation
(
T
startOffset
,
T
endOffset
,
U
startVelocity
,
U
endVelocity
)
=>
null
;
/// Returns the scroll offset to use when the user attempts to scroll
/// from the given offset by the given delta.
double
applyCurve
(
double
scrollOffset
,
double
scrollDelta
)
;
T
applyCurve
(
T
scrollOffset
,
T
scrollDelta
)
=>
scrollOffset
;
/// Whether this scroll behavior currently permits scrolling
bool
get
isScrollable
=>
true
;
}
/// A scroll behavior for a scrollable widget with linear extent.
abstract
class
ExtentScrollBehavior
extends
ScrollBehavior
{
/// A scroll behavior for a scrollable widget with linear extent (i.e.
/// that only scrolls along one axis).
abstract
class
ExtentScrollBehavior
extends
ScrollBehavior
<
double
,
double
>
{
ExtentScrollBehavior
({
double
contentExtent:
0.0
,
double
containerExtent:
0.0
})
:
_contentExtent
=
contentExtent
,
_containerExtent
=
containerExtent
;
...
...
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