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
a271eb56
Commit
a271eb56
authored
Jan 06, 2016
by
Adam Barth
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1081 from abarth/ship_scrollable_list2
Replace ScrollableList with ScrollableList2
parents
fa15fc2d
627c1ffb
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
16 additions
and
69 deletions
+16
-69
feed.dart
examples/fitness/lib/feed.dart
+1
-1
stock_list.dart
examples/stocks/lib/stock_list.dart
+1
-1
card_collection.dart
examples/widgets/card_collection.dart
+1
-1
media_query.dart
examples/widgets/media_query.dart
+1
-1
scrollbar.dart
examples/widgets/scrollbar.dart
+1
-1
material_list.dart
packages/flutter/lib/src/material/material_list.dart
+1
-1
scrollable.dart
packages/flutter/lib/src/widgets/scrollable.dart
+0
-53
scrollable_list.dart
packages/flutter/lib/src/widgets/scrollable_list.dart
+3
-3
dismissable_test.dart
packages/flutter/test/widget/dismissable_test.dart
+1
-1
reparent_state_test.dart
packages/flutter/test/widget/reparent_state_test.dart
+1
-1
scrollable_list_hit_testing_test.dart
...flutter/test/widget/scrollable_list_hit_testing_test.dart
+2
-2
scrollable_list_horizontal_test.dart
.../flutter/test/widget/scrollable_list_horizontal_test.dart
+1
-1
scrollable_list_vertical_test.dart
...es/flutter/test/widget/scrollable_list_vertical_test.dart
+1
-1
snap_scrolling_test.dart
packages/flutter/test/widget/snap_scrolling_test.dart
+1
-1
No files found.
examples/fitness/lib/feed.dart
View file @
a271eb56
...
...
@@ -14,7 +14,7 @@ class FitnessItemList extends StatelessComponent {
final
FitnessItemHandler
onDismissed
;
Widget
build
(
BuildContext
context
)
{
return
new
ScrollableList
2
(
return
new
ScrollableList
(
padding:
const
EdgeDims
.
all
(
4.0
),
itemExtent:
kFitnessItemHeight
,
children:
items
.
map
((
FitnessItem
item
)
=>
item
.
toRow
(
onDismissed:
onDismissed
))
...
...
examples/stocks/lib/stock_list.dart
View file @
a271eb56
...
...
@@ -14,7 +14,7 @@ class StockList extends StatelessComponent {
final
StockRowActionCallback
onAction
;
Widget
build
(
BuildContext
context
)
{
return
new
ScrollableList
2
(
return
new
ScrollableList
(
itemExtent:
StockRow
.
kHeight
,
children:
stocks
.
map
((
Stock
stock
)
{
return
new
StockRow
(
...
...
examples/widgets/card_collection.dart
View file @
a271eb56
...
...
@@ -393,7 +393,7 @@ class CardCollectionState extends State<CardCollection> {
Widget
build
(
BuildContext
context
)
{
Widget
cardCollection
;
if
(
_fixedSizeCards
)
{
cardCollection
=
new
ScrollableList
2
(
cardCollection
=
new
ScrollableList
(
snapOffsetCallback:
_snapToCenter
?
_toSnapOffset
:
null
,
snapAlignmentOffset:
_cardCollectionSize
.
height
/
2.0
,
itemExtent:
_cardModels
[
0
].
height
,
...
...
examples/widgets/media_query.dart
View file @
a271eb56
...
...
@@ -72,7 +72,7 @@ class MediaQueryExample extends StatelessComponent {
items
.
add
(
new
AdaptiveItem
(
"Item
$i
"
));
if
(
MediaQuery
.
of
(
context
).
size
.
width
<
_gridViewBreakpoint
)
{
return
new
ScrollableList
2
(
return
new
ScrollableList
(
itemExtent:
50.0
,
children:
items
.
map
((
AdaptiveItem
item
)
=>
item
.
toListItem
())
);
...
...
examples/widgets/scrollbar.dart
View file @
a271eb56
...
...
@@ -30,7 +30,7 @@ class ScrollbarAppState extends State<ScrollbarApp> {
final
ScrollbarPainter
_scrollbarPainter
=
new
ScrollbarPainter
();
Widget
_buildMenu
(
BuildContext
context
)
{
return
new
ScrollableList
2
(
return
new
ScrollableList
(
itemExtent:
_itemExtent
,
scrollableListPainter:
_scrollbarPainter
,
children:
new
List
<
Widget
>.
generate
(
_itemCount
,
(
int
i
)
=>
new
_Item
(
i
))
...
...
packages/flutter/lib/src/material/material_list.dart
View file @
a271eb56
...
...
@@ -42,7 +42,7 @@ class _MaterialListState extends State<MaterialList> {
ScrollbarPainter
_scrollbarPainter
=
new
ScrollbarPainter
();
Widget
build
(
BuildContext
context
)
{
return
new
ScrollableList
2
(
return
new
ScrollableList
(
initialScrollOffset:
config
.
initialScrollOffset
,
scrollDirection:
ScrollDirection
.
vertical
,
onScroll:
config
.
onScroll
,
...
...
packages/flutter/lib/src/widgets/scrollable.dart
View file @
a271eb56
...
...
@@ -666,59 +666,6 @@ abstract class ScrollableWidgetListState<T extends ScrollableWidgetList> extends
typedef
Widget
ItemBuilder
<
T
>(
BuildContext
context
,
T
item
,
int
index
);
/// A wrapper around [ScrollableWidgetList] that helps you translate a list of
/// model objects into a scrollable list of widgets. Assumes all the widgets
/// have the same height.
class
ScrollableList
<
T
>
extends
ScrollableWidgetList
{
ScrollableList
({
Key
key
,
double
initialScrollOffset
,
ScrollDirection
scrollDirection:
ScrollDirection
.
vertical
,
ScrollListener
onScroll
,
SnapOffsetCallback
snapOffsetCallback
,
double
snapAlignmentOffset:
0.0
,
this
.
items
,
this
.
itemBuilder
,
bool
itemsWrap:
false
,
double
itemExtent
,
EdgeDims
padding
,
ScrollableListPainter
scrollableListPainter
})
:
super
(
key:
key
,
initialScrollOffset:
initialScrollOffset
,
scrollDirection:
scrollDirection
,
onScroll:
onScroll
,
snapOffsetCallback:
snapOffsetCallback
,
snapAlignmentOffset:
snapAlignmentOffset
,
itemsWrap:
itemsWrap
,
itemExtent:
itemExtent
,
padding:
padding
,
scrollableListPainter:
scrollableListPainter
);
final
List
<
T
>
items
;
final
ItemBuilder
<
T
>
itemBuilder
;
ScrollableListState
<
T
,
ScrollableList
<
T
>>
createState
()
=>
new
ScrollableListState
<
T
,
ScrollableList
<
T
>>();
}
class
ScrollableListState
<
T
,
Config
extends
ScrollableList
<
T
>>
extends
ScrollableWidgetListState
<
Config
>
{
ScrollBehavior
createScrollBehavior
()
{
return
config
.
itemsWrap
?
new
UnboundedBehavior
()
:
super
.
createScrollBehavior
();
}
int
get
itemCount
=>
config
.
items
.
length
;
List
<
Widget
>
buildItems
(
BuildContext
context
,
int
start
,
int
count
)
{
List
<
Widget
>
result
=
new
List
<
Widget
>();
int
begin
=
config
.
itemsWrap
?
start
:
math
.
max
(
0
,
start
);
int
end
=
config
.
itemsWrap
?
begin
+
count
:
math
.
min
(
begin
+
count
,
config
.
items
.
length
);
for
(
int
i
=
begin
;
i
<
end
;
++
i
)
result
.
add
(
config
.
itemBuilder
(
context
,
config
.
items
[
i
%
itemCount
],
i
));
return
result
;
}
}
/// A general scrollable list for a large number of children that might not all
/// have the same height. Prefer [ScrollableWidgetList] when all the children
/// have the same height because it can use that property to be more efficient.
...
...
packages/flutter/lib/src/widgets/scrollable_list.dart
View file @
a271eb56
...
...
@@ -11,8 +11,8 @@ import 'virtual_viewport.dart';
import
'package:flutter/animation.dart'
;
import
'package:flutter/rendering.dart'
;
class
ScrollableList
2
extends
Scrollable
{
ScrollableList
2
({
class
ScrollableList
extends
Scrollable
{
ScrollableList
({
Key
key
,
double
initialScrollOffset
,
ScrollDirection
scrollDirection:
ScrollDirection
.
vertical
,
...
...
@@ -44,7 +44,7 @@ class ScrollableList2 extends Scrollable {
ScrollableState
createState
()
=>
new
_ScrollableList2State
();
}
class
_ScrollableList2State
extends
ScrollableState
<
ScrollableList
2
>
{
class
_ScrollableList2State
extends
ScrollableState
<
ScrollableList
>
{
ScrollBehavior
createScrollBehavior
()
=>
new
OverscrollBehavior
();
ExtentScrollBehavior
get
scrollBehavior
=>
super
.
scrollBehavior
;
...
...
packages/flutter/test/widget/dismissable_test.dart
View file @
a271eb56
...
...
@@ -38,7 +38,7 @@ Widget buildDismissableItem(int item) {
Widget
widgetBuilder
(
)
{
return
new
Container
(
padding:
const
EdgeDims
.
all
(
10.0
),
child:
new
ScrollableList
2
(
child:
new
ScrollableList
(
scrollDirection:
scrollDirection
,
itemExtent:
itemExtent
,
children:
<
int
>[
0
,
1
,
2
,
3
,
4
].
where
(
...
...
packages/flutter/test/widget/reparent_state_test.dart
View file @
a271eb56
...
...
@@ -99,7 +99,7 @@ void main() {
(
key
.
currentState
as
StateMarkerState
).
marker
=
"marked"
;
tester
.
pumpWidget
(
new
ScrollableList
2
(
tester
.
pumpWidget
(
new
ScrollableList
(
itemExtent:
100.0
,
children:
<
Widget
>[
new
Container
(
...
...
packages/flutter/test/widget/scrollable_list_hit_testing_test.dart
View file @
a271eb56
...
...
@@ -17,7 +17,7 @@ void main() {
tester
.
pumpWidget
(
new
Center
(
child:
new
Container
(
height:
50.0
,
child:
new
ScrollableList
2
(
child:
new
ScrollableList
(
key:
new
GlobalKey
(),
itemExtent:
290.0
,
scrollDirection:
ScrollDirection
.
horizontal
,
...
...
@@ -57,7 +57,7 @@ void main() {
tester
.
pumpWidget
(
new
Center
(
child:
new
Container
(
width:
50.0
,
child:
new
ScrollableList
2
(
child:
new
ScrollableList
(
key:
new
GlobalKey
(),
itemExtent:
290.0
,
scrollDirection:
ScrollDirection
.
vertical
,
...
...
packages/flutter/test/widget/scrollable_list_horizontal_test.dart
View file @
a271eb56
...
...
@@ -13,7 +13,7 @@ Widget buildFrame() {
return
new
Center
(
child:
new
Container
(
height:
50.0
,
child:
new
ScrollableList
2
(
child:
new
ScrollableList
(
itemExtent:
290.0
,
scrollDirection:
ScrollDirection
.
horizontal
,
children:
items
.
map
((
int
item
)
{
...
...
packages/flutter/test/widget/scrollable_list_vertical_test.dart
View file @
a271eb56
...
...
@@ -9,7 +9,7 @@ import 'package:test/test.dart';
const
List
<
int
>
items
=
const
<
int
>[
0
,
1
,
2
,
3
,
4
,
5
];
Widget
buildFrame
(
)
{
return
new
ScrollableList
2
(
return
new
ScrollableList
(
itemExtent:
290.0
,
scrollDirection:
ScrollDirection
.
vertical
,
children:
items
.
map
((
int
item
)
{
...
...
packages/flutter/test/widget/snap_scrolling_test.dart
View file @
a271eb56
...
...
@@ -29,7 +29,7 @@ Widget buildFrame() {
return
new
Center
(
child:
new
Container
(
height:
itemExtent
*
2.0
,
child:
new
ScrollableList
2
(
child:
new
ScrollableList
(
key:
scrollableListKey
,
snapOffsetCallback:
snapOffsetCallback
,
scrollDirection:
scrollDirection
,
...
...
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