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
6a2edbbf
Commit
6a2edbbf
authored
Mar 13, 2016
by
Adam Barth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[rename fixit] ItemsSnapAlignment -> PageableListFlingBehavior
Fixes #2448
parent
9b9ad3db
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
11 deletions
+13
-11
pageable_list.dart
packages/flutter/lib/src/widgets/pageable_list.dart
+13
-11
No files found.
packages/flutter/lib/src/widgets/pageable_list.dart
View file @
6a2edbbf
...
...
@@ -12,10 +12,10 @@ import 'scroll_behavior.dart';
import
'scrollable.dart'
;
import
'virtual_viewport.dart'
;
/// Controls
what alignment items use when sett
ling.
enum
ItemsSnapAlignment
{
item
,
adjacentItem
/// Controls
how a pageable list should behave during a f
ling.
enum
PageableListFlingBehavior
{
canFlingAcrossMultiplePages
,
stopAtNextPage
}
/// Scrollable widget that scrolls one "page" at a time.
...
...
@@ -33,7 +33,7 @@ class PageableList extends Scrollable {
ScrollListener
onScrollEnd
,
SnapOffsetCallback
snapOffsetCallback
,
this
.
itemsWrap
:
false
,
this
.
itemsSnapAlignment
:
ItemsSnapAlignment
.
adjacentItem
,
this
.
itemsSnapAlignment
:
PageableListFlingBehavior
.
stopAtNextPage
,
this
.
onPageChanged
,
this
.
scrollableListPainter
,
this
.
duration
:
const
Duration
(
milliseconds:
200
),
...
...
@@ -48,13 +48,15 @@ class PageableList extends Scrollable {
onScroll:
onScroll
,
onScrollEnd:
onScrollEnd
,
snapOffsetCallback:
snapOffsetCallback
);
)
{
assert
(
itemsSnapAlignment
!=
null
);
}
/// Whether the first item should be revealed after scrolling past the last item.
final
bool
itemsWrap
;
/// Controls whether a fling always reveals the adjacent item or whether flings can traverse many items.
final
ItemsSnapAlignment
itemsSnapAlignment
;
final
PageableListFlingBehavior
itemsSnapAlignment
;
/// Called when the currently visible page changes.
final
ValueChanged
<
int
>
onPageChanged
;
...
...
@@ -187,7 +189,7 @@ class PageableListState<T extends PageableList> extends ScrollableState<T> {
ScrollBehavior
<
double
,
double
>
createScrollBehavior
()
=>
scrollBehavior
;
bool
get
shouldSnapScrollOffset
=>
config
.
itemsSnapAlignment
==
ItemsSnapAlignment
.
item
;
bool
get
shouldSnapScrollOffset
=>
config
.
itemsSnapAlignment
==
PageableListFlingBehavior
.
canFlingAcrossMultiplePages
;
double
snapScrollOffset
(
double
newScrollOffset
)
{
final
double
previousItemOffset
=
newScrollOffset
.
floorToDouble
();
...
...
@@ -205,10 +207,10 @@ class PageableListState<T extends PageableList> extends ScrollableState<T> {
Future
<
Null
>
fling
(
double
scrollVelocity
)
{
switch
(
config
.
itemsSnapAlignment
)
{
case
ItemsSnapAlignment
.
adjacentItem
:
return
_flingToAdjacentItem
(
scrollVelocity
);
default
:
case
PageableListFlingBehavior
.
canFlingAcrossMultiplePages
:
return
super
.
fling
(
scrollVelocity
).
then
(
_notifyPageChanged
);
case
PageableListFlingBehavior
.
stopAtNextPage
:
return
_flingToAdjacentItem
(
scrollVelocity
);
}
}
...
...
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