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
b2cef9f2
Commit
b2cef9f2
authored
Jan 11, 2016
by
Adam Barth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename ScrollDirection to Axis
We use the ScrollDirection for more than just scrolling. Fixes #151
parent
253d6874
Changes
26
Hide whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
138 additions
and
138 deletions
+138
-138
horizontal_scrolling.dart
examples/widgets/horizontal_scrolling.dart
+1
-1
pageable_list.dart
examples/widgets/pageable_list.dart
+8
-8
input.dart
packages/flutter/lib/src/material/input.dart
+1
-1
material_list.dart
packages/flutter/lib/src/material/material_list.dart
+1
-1
scrollbar_painter.dart
packages/flutter/lib/src/material/scrollbar_painter.dart
+2
-2
tabs.dart
packages/flutter/lib/src/material/tabs.dart
+4
-4
block.dart
packages/flutter/lib/src/rendering/block.dart
+8
-8
box.dart
packages/flutter/lib/src/rendering/box.dart
+9
-0
list.dart
packages/flutter/lib/src/rendering/list.dart
+14
-14
viewport.dart
packages/flutter/lib/src/rendering/viewport.dart
+10
-19
basic.dart
packages/flutter/lib/src/widgets/basic.dart
+6
-6
homogeneous_viewport.dart
packages/flutter/lib/src/widgets/homogeneous_viewport.dart
+5
-5
mixed_viewport.dart
packages/flutter/lib/src/widgets/mixed_viewport.dart
+8
-8
pageable_list.dart
packages/flutter/lib/src/widgets/pageable_list.dart
+6
-6
scrollable.dart
packages/flutter/lib/src/widgets/scrollable.dart
+28
-28
scrollable_grid.dart
packages/flutter/lib/src/widgets/scrollable_grid.dart
+2
-2
scrollable_list.dart
packages/flutter/lib/src/widgets/scrollable_list.dart
+5
-5
virtual_viewport.dart
packages/flutter/lib/src/widgets/virtual_viewport.dart
+3
-3
dismissable_test.dart
packages/flutter/test/widget/dismissable_test.dart
+8
-8
homogeneous_viewport_test.dart
packages/flutter/test/widget/homogeneous_viewport_test.dart
+1
-1
mixed_viewport_test.dart
packages/flutter/test/widget/mixed_viewport_test.dart
+1
-1
pageable_list_test.dart
packages/flutter/test/widget/pageable_list_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
+2
-2
No files found.
examples/widgets/horizontal_scrolling.dart
View file @
b2cef9f2
...
...
@@ -41,7 +41,7 @@ class HorizontalScrollingApp extends StatelessComponent {
return
new
Center
(
child:
new
Container
(
height:
50.0
,
child:
new
Block
(
circles
,
scrollDirection:
ScrollDirection
.
horizontal
)
child:
new
Block
(
circles
,
scrollDirection:
Axis
.
horizontal
)
)
);
}
...
...
examples/widgets/pageable_list.dart
View file @
b2cef9f2
...
...
@@ -38,7 +38,7 @@ class PageableListAppState extends State<PageableListApp> {
List
<
CardModel
>
cardModels
;
Size
pageSize
=
new
Size
(
200.0
,
200.0
);
ScrollDirection
scrollDirection
=
ScrollDirection
.
horizontal
;
Axis
scrollDirection
=
Axis
.
horizontal
;
bool
itemsWrap
=
false
;
Widget
buildCard
(
CardModel
cardModel
)
{
...
...
@@ -52,7 +52,7 @@ class PageableListAppState extends State<PageableListApp> {
)
);
BoxConstraints
constraints
=
(
scrollDirection
==
ScrollDirection
.
vertical
)
BoxConstraints
constraints
=
(
scrollDirection
==
Axis
.
vertical
)
?
new
BoxConstraints
.
tightFor
(
height:
pageSize
.
height
)
:
new
BoxConstraints
.
tightFor
(
width:
pageSize
.
width
);
...
...
@@ -65,9 +65,9 @@ class PageableListAppState extends State<PageableListApp> {
void
switchScrollDirection
()
{
setState
(()
{
scrollDirection
=
(
scrollDirection
==
ScrollDirection
.
vertical
)
?
ScrollDirection
.
horizontal
:
ScrollDirection
.
vertical
;
scrollDirection
=
(
scrollDirection
==
Axis
.
vertical
)
?
Axis
.
horizontal
:
Axis
.
vertical
;
});
}
...
...
@@ -83,13 +83,13 @@ class PageableListAppState extends State<PageableListApp> {
new
DrawerHeader
(
child:
new
Text
(
'Options'
)),
new
DrawerItem
(
icon:
'navigation/more_horiz'
,
selected:
scrollDirection
==
ScrollDirection
.
horizontal
,
selected:
scrollDirection
==
Axis
.
horizontal
,
child:
new
Text
(
'Horizontal Layout'
),
onPressed:
switchScrollDirection
),
new
DrawerItem
(
icon:
'navigation/more_vert'
,
selected:
scrollDirection
==
ScrollDirection
.
vertical
,
selected:
scrollDirection
==
Axis
.
vertical
,
child:
new
Text
(
'Vertical Layout'
),
onPressed:
switchScrollDirection
),
...
...
@@ -108,7 +108,7 @@ class PageableListAppState extends State<PageableListApp> {
return
new
ToolBar
(
center:
new
Text
(
'PageableList'
),
right:
<
Widget
>[
new
Text
(
scrollDirection
==
ScrollDirection
.
horizontal
?
"horizontal"
:
"vertical"
)
new
Text
(
scrollDirection
==
Axis
.
horizontal
?
"horizontal"
:
"vertical"
)
]
);
}
...
...
packages/flutter/lib/src/material/input.dart
View file @
b2cef9f2
...
...
@@ -26,7 +26,7 @@ class Input extends Scrollable {
})
:
super
(
key:
key
,
initialScrollOffset:
0.0
,
scrollDirection:
ScrollDirection
.
horizontal
scrollDirection:
Axis
.
horizontal
)
{
assert
(
key
!=
null
);
}
...
...
packages/flutter/lib/src/material/material_list.dart
View file @
b2cef9f2
...
...
@@ -44,7 +44,7 @@ class _MaterialListState extends State<MaterialList> {
Widget
build
(
BuildContext
context
)
{
return
new
ScrollableList
(
initialScrollOffset:
config
.
initialScrollOffset
,
scrollDirection:
ScrollDirection
.
vertical
,
scrollDirection:
Axis
.
vertical
,
onScroll:
config
.
onScroll
,
itemExtent:
_kItemExtent
[
config
.
type
],
padding:
const
EdgeDims
.
symmetric
(
vertical:
8.0
),
...
...
packages/flutter/lib/src/material/scrollbar_painter.dart
View file @
b2cef9f2
...
...
@@ -31,7 +31,7 @@ class ScrollbarPainter extends ScrollableListPainter {
Size
thumbSize
;
switch
(
scrollDirection
)
{
case
ScrollDirection
.
vertical
:
case
Axis
.
vertical
:
double
thumbHeight
=
viewportBounds
.
height
*
viewportBounds
.
height
/
contentExtent
;
thumbHeight
=
thumbHeight
.
clamp
(
_kMinScrollbarThumbLength
,
viewportBounds
.
height
);
final
double
maxThumbTop
=
viewportBounds
.
height
-
thumbHeight
;
...
...
@@ -40,7 +40,7 @@ class ScrollbarPainter extends ScrollableListPainter {
thumbOrigin
=
new
Point
(
viewportBounds
.
right
-
_kScrollbarThumbGirth
,
thumbTop
);
thumbSize
=
new
Size
(
_kScrollbarThumbGirth
,
thumbHeight
);
break
;
case
ScrollDirection
.
horizontal
:
case
Axis
.
horizontal
:
double
thumbWidth
=
viewportBounds
.
width
*
viewportBounds
.
width
/
contentExtent
;
thumbWidth
=
thumbWidth
.
clamp
(
_kMinScrollbarThumbLength
,
viewportBounds
.
width
);
final
double
maxThumbLeft
=
viewportBounds
.
width
-
thumbWidth
;
...
...
packages/flutter/lib/src/material/tabs.dart
View file @
b2cef9f2
...
...
@@ -544,7 +544,7 @@ class TabBar<T> extends Scrollable {
Key
key
,
this
.
labels
,
this
.
isScrollable
:
false
})
:
super
(
key:
key
,
scrollDirection:
ScrollDirection
.
horizontal
);
})
:
super
(
key:
key
,
scrollDirection:
Axis
.
horizontal
);
final
Map
<
T
,
TabLabel
>
labels
;
final
bool
isScrollable
;
...
...
@@ -687,7 +687,7 @@ class _TabBarState<T> extends ScrollableState<TabBar<T>> implements TabBarSelect
void
_updateScrollBehavior
()
{
scrollBehavior
.
updateExtents
(
containerExtent:
config
.
scrollDirection
==
ScrollDirection
.
vertical
?
_viewportSize
.
height
:
_viewportSize
.
width
,
containerExtent:
config
.
scrollDirection
==
Axis
.
vertical
?
_viewportSize
.
height
:
_viewportSize
.
width
,
contentExtent:
_tabWidths
.
reduce
((
double
sum
,
double
width
)
=>
sum
+
width
)
);
}
...
...
@@ -753,7 +753,7 @@ class _TabBarState<T> extends ScrollableState<TabBar<T>> implements TabBarSelect
contents
=
new
SizeObserver
(
onSizeChanged:
_handleViewportSizeChanged
,
child:
new
Viewport
(
scrollDirection:
ScrollDirection
.
horizontal
,
scrollDirection:
Axis
.
horizontal
,
scrollOffset:
new
Offset
(
scrollOffset
,
0.0
),
child:
contents
)
...
...
@@ -770,7 +770,7 @@ class TabBarView extends PageableList {
List
<
Widget
>
children
})
:
super
(
key:
key
,
scrollDirection:
ScrollDirection
.
horizontal
,
scrollDirection:
Axis
.
horizontal
,
children:
children
)
{
assert
(
children
!=
null
);
...
...
packages/flutter/lib/src/rendering/block.dart
View file @
b2cef9f2
...
...
@@ -32,7 +32,7 @@ abstract class RenderBlockBase extends RenderBox
RenderBlockBase
({
List
<
RenderBox
>
children
,
ScrollDirection
direction:
ScrollDirection
.
vertical
,
Axis
direction:
Axis
.
vertical
,
double
itemExtent
,
double
minExtent:
0.0
})
:
_direction
=
direction
,
_itemExtent
=
itemExtent
,
_minExtent
=
minExtent
{
...
...
@@ -45,9 +45,9 @@ abstract class RenderBlockBase extends RenderBox
}
/// The direction to use as the main axis.
ScrollDirection
get
direction
=>
_direction
;
ScrollDirection
_direction
;
void
set
direction
(
ScrollDirection
value
)
{
Axis
get
direction
=>
_direction
;
Axis
_direction
;
void
set
direction
(
Axis
value
)
{
if
(
_direction
!=
value
)
{
_direction
=
value
;
markNeedsLayout
();
...
...
@@ -75,9 +75,9 @@ abstract class RenderBlockBase extends RenderBox
}
/// Whether the main axis is vertical.
bool
get
isVertical
=>
_direction
==
ScrollDirection
.
vertical
;
bool
get
isVertical
=>
_direction
==
Axis
.
vertical
;
ScrollDirection
get
scrollDirection
=>
_direction
;
Axis
get
scrollDirection
=>
_direction
;
BoxConstraints
_getInnerConstraints
(
BoxConstraints
constraints
)
{
if
(
isVertical
)
...
...
@@ -126,7 +126,7 @@ class RenderBlock extends RenderBlockBase {
RenderBlock
({
List
<
RenderBox
>
children
,
ScrollDirection
direction:
ScrollDirection
.
vertical
,
Axis
direction:
Axis
.
vertical
,
double
itemExtent
,
double
minExtent:
0.0
})
:
super
(
children:
children
,
direction:
direction
,
itemExtent:
itemExtent
,
minExtent:
minExtent
);
...
...
@@ -242,7 +242,7 @@ class RenderBlockViewport extends RenderBlockBase {
ExtentCallback
maxCrossAxisDimensionCallback
,
ExtentCallback
minCrossAxisDimensionCallback
,
Painter
overlayPainter
,
ScrollDirection
direction:
ScrollDirection
.
vertical
,
Axis
direction:
Axis
.
vertical
,
double
itemExtent
,
double
minExtent:
0.0
,
double
startOffset:
0.0
,
...
...
packages/flutter/lib/src/rendering/box.dart
View file @
b2cef9f2
...
...
@@ -23,6 +23,15 @@ class _DebugSize extends Size {
final
bool
_canBeUsedByParent
;
}
/// The two cardinal directions in two dimensions.
enum
Axis
{
/// Left and right
horizontal
,
/// Up and down
vertical
,
}
/// Immutable layout constraints for box layout.
///
/// A size respects a BoxConstraints if, and only if, all of the following
...
...
packages/flutter/lib/src/rendering/list.dart
View file @
b2cef9f2
...
...
@@ -18,7 +18,7 @@ class RenderList extends RenderVirtualViewport<ListParentData> implements HasScr
EdgeDims
padding
,
int
virtualChildCount
,
Offset
paintOffset:
Offset
.
zero
,
ScrollDirection
scrollDirection:
ScrollDirection
.
vertical
,
Axis
scrollDirection:
Axis
.
vertical
,
LayoutCallback
callback
})
:
_itemExtent
=
itemExtent
,
_padding
=
padding
,
...
...
@@ -50,9 +50,9 @@ class RenderList extends RenderVirtualViewport<ListParentData> implements HasScr
markNeedsLayout
();
}
ScrollDirection
get
scrollDirection
=>
_scrollDirection
;
ScrollDirection
_scrollDirection
;
void
set
scrollDirection
(
ScrollDirection
newValue
)
{
Axis
get
scrollDirection
=>
_scrollDirection
;
Axis
_scrollDirection
;
void
set
scrollDirection
(
Axis
newValue
)
{
if
(
_scrollDirection
==
newValue
)
return
;
_scrollDirection
=
newValue
;
...
...
@@ -66,9 +66,9 @@ class RenderList extends RenderVirtualViewport<ListParentData> implements HasScr
double
get
_scrollAxisPadding
{
switch
(
scrollDirection
)
{
case
ScrollDirection
.
vertical
:
case
Axis
.
vertical
:
return
padding
.
vertical
;
case
ScrollDirection
.
horizontal
:
case
Axis
.
horizontal
:
return
padding
.
horizontal
;
}
}
...
...
@@ -85,9 +85,9 @@ class RenderList extends RenderVirtualViewport<ListParentData> implements HasScr
double
_getIntrinsicWidth
(
BoxConstraints
constraints
)
{
assert
(
constraints
.
isNormalized
);
switch
(
scrollDirection
)
{
case
ScrollDirection
.
vertical
:
case
Axis
.
vertical
:
return
constraints
.
constrainWidth
(
0.0
);
case
ScrollDirection
.
horizontal
:
case
Axis
.
horizontal
:
return
constraints
.
constrainWidth
(
_preferredExtent
);
}
}
...
...
@@ -103,9 +103,9 @@ class RenderList extends RenderVirtualViewport<ListParentData> implements HasScr
double
_getIntrinsicHeight
(
BoxConstraints
constraints
)
{
assert
(
constraints
.
isNormalized
);
switch
(
scrollDirection
)
{
case
ScrollDirection
.
vertical
:
case
Axis
.
vertical
:
return
constraints
.
constrainHeight
(
_preferredExtent
);
case
ScrollDirection
.
horizontal
:
case
Axis
.
horizontal
:
return
constraints
.
constrainHeight
(
0.0
);
}
}
...
...
@@ -120,11 +120,11 @@ class RenderList extends RenderVirtualViewport<ListParentData> implements HasScr
void
performLayout
()
{
switch
(
scrollDirection
)
{
case
ScrollDirection
.
vertical
:
case
Axis
.
vertical
:
size
=
new
Size
(
constraints
.
maxWidth
,
constraints
.
constrainHeight
(
_preferredExtent
));
break
;
case
ScrollDirection
.
horizontal
:
case
Axis
.
horizontal
:
size
=
new
Size
(
constraints
.
constrainWidth
(
_preferredExtent
),
constraints
.
maxHeight
);
break
;
...
...
@@ -143,13 +143,13 @@ class RenderList extends RenderVirtualViewport<ListParentData> implements HasScr
double
dy
=
0.0
;
switch
(
scrollDirection
)
{
case
ScrollDirection
.
vertical
:
case
Axis
.
vertical
:
itemWidth
=
math
.
max
(
0
,
size
.
width
-
(
padding
==
null
?
0.0
:
padding
.
horizontal
));
itemHeight
=
itemExtent
??
size
.
height
;
y
=
padding
!=
null
?
padding
.
top
:
0.0
;
dy
=
itemHeight
;
break
;
case
ScrollDirection
.
horizontal
:
case
Axis
.
horizontal
:
itemWidth
=
itemExtent
??
size
.
width
;
itemHeight
=
math
.
max
(
0
,
size
.
height
-
(
padding
==
null
?
0.0
:
padding
.
vertical
));
x
=
padding
!=
null
?
padding
.
left
:
0.0
;
...
...
packages/flutter/lib/src/rendering/viewport.dart
View file @
b2cef9f2
...
...
@@ -9,17 +9,8 @@ import 'package:vector_math/vector_math_64.dart';
import
'box.dart'
;
import
'object.dart'
;
/// The direction in which to scroll
enum
ScrollDirection
{
/// Scroll left and right
horizontal
,
/// Scroll up and down
vertical
,
}
abstract
class
HasScrollDirection
{
ScrollDirection
get
scrollDirection
;
Axis
get
scrollDirection
;
}
/// A render object that's bigger on the inside.
...
...
@@ -37,18 +28,18 @@ class RenderViewport extends RenderBox with RenderObjectWithChildMixin<RenderBox
RenderViewport
({
RenderBox
child
,
Offset
scrollOffset:
Offset
.
zero
,
ScrollDirection
scrollDirection:
ScrollDirection
.
vertical
Axis
scrollDirection:
Axis
.
vertical
})
:
_scrollOffset
=
scrollOffset
,
_scrollDirection
=
scrollDirection
{
assert
(
_offsetIsSane
(
scrollOffset
,
scrollDirection
));
this
.
child
=
child
;
}
bool
_offsetIsSane
(
Offset
offset
,
ScrollDirection
direction
)
{
bool
_offsetIsSane
(
Offset
offset
,
Axis
direction
)
{
switch
(
direction
)
{
case
ScrollDirection
.
horizontal
:
case
Axis
.
horizontal
:
return
offset
.
dy
==
0.0
;
case
ScrollDirection
.
vertical
:
case
Axis
.
vertical
:
return
offset
.
dx
==
0.0
;
}
}
...
...
@@ -71,9 +62,9 @@ class RenderViewport extends RenderBox with RenderObjectWithChildMixin<RenderBox
/// If the viewport is scrollable in a particular direction (e.g., vertically),
/// the child is given layout constraints that are fully unconstrainted in
/// that direction (e.g., the child can be as tall as it wants).
ScrollDirection
get
scrollDirection
=>
_scrollDirection
;
ScrollDirection
_scrollDirection
;
void
set
scrollDirection
(
ScrollDirection
value
)
{
Axis
get
scrollDirection
=>
_scrollDirection
;
Axis
_scrollDirection
;
void
set
scrollDirection
(
Axis
value
)
{
if
(
value
==
_scrollDirection
)
return
;
assert
(
_offsetIsSane
(
scrollOffset
,
value
));
...
...
@@ -84,10 +75,10 @@ class RenderViewport extends RenderBox with RenderObjectWithChildMixin<RenderBox
BoxConstraints
_getInnerConstraints
(
BoxConstraints
constraints
)
{
BoxConstraints
innerConstraints
;
switch
(
scrollDirection
)
{
case
ScrollDirection
.
horizontal
:
case
Axis
.
horizontal
:
innerConstraints
=
constraints
.
heightConstraints
();
break
;
case
ScrollDirection
.
vertical
:
case
Axis
.
vertical
:
innerConstraints
=
constraints
.
widthConstraints
();
break
;
}
...
...
packages/flutter/lib/src/widgets/basic.dart
View file @
b2cef9f2
...
...
@@ -54,7 +54,7 @@ export 'package:flutter/rendering.dart' show
PointerUpEvent
,
RadialGradient
,
Rect
,
ScrollDirection
,
Axis
,
Size
,
StyledTextSpan
,
TextAlign
,
...
...
@@ -755,7 +755,7 @@ class Baseline extends OneChildRenderObjectWidget {
class
Viewport
extends
OneChildRenderObjectWidget
{
Viewport
({
Key
key
,
this
.
scrollDirection
:
ScrollDirection
.
vertical
,
this
.
scrollDirection
:
Axis
.
vertical
,
this
.
scrollOffset
:
Offset
.
zero
,
Widget
child
})
:
super
(
key:
key
,
child:
child
)
{
...
...
@@ -768,7 +768,7 @@ class Viewport extends OneChildRenderObjectWidget {
/// If the viewport is scrollable in a particular direction (e.g., vertically),
/// the child is given layout constraints that are fully unconstrainted in
/// that direction (e.g., the child can be as tall as it wants).
final
ScrollDirection
scrollDirection
;
final
Axis
scrollDirection
;
/// The offset at which to paint the child.
///
...
...
@@ -824,7 +824,7 @@ class Container extends StatelessComponent {
this
.
transform
,
double
width
,
double
height
})
:
constraints
=
})
:
constraints
=
(
width
!=
null
||
height
!=
null
)
?
constraints
?.
tighten
(
width:
width
,
height:
height
)
??
new
BoxConstraints
.
tightFor
(
width:
width
,
height:
height
)
...
...
@@ -929,13 +929,13 @@ class Container extends StatelessComponent {
class
BlockBody
extends
MultiChildRenderObjectWidget
{
BlockBody
(
List
<
Widget
>
children
,
{
Key
key
,
this
.
direction
:
ScrollDirection
.
vertical
this
.
direction
:
Axis
.
vertical
})
:
super
(
key:
key
,
children:
children
)
{
assert
(
direction
!=
null
);
}
/// The direction to use as the main axis.
final
ScrollDirection
direction
;
final
Axis
direction
;
RenderBlock
createRenderObject
()
=>
new
RenderBlock
(
direction:
direction
);
...
...
packages/flutter/lib/src/widgets/homogeneous_viewport.dart
View file @
b2cef9f2
...
...
@@ -17,7 +17,7 @@ abstract class _ViewportBase extends RenderObjectWidget {
this
.
builder
,
this
.
itemsWrap
:
false
,
this
.
itemCount
,
this
.
direction
:
ScrollDirection
.
vertical
,
this
.
direction
:
Axis
.
vertical
,
this
.
startOffset
:
0.0
,
this
.
overlayPainter
})
:
super
(
key:
key
);
...
...
@@ -25,7 +25,7 @@ abstract class _ViewportBase extends RenderObjectWidget {
final
ListBuilder
builder
;
final
bool
itemsWrap
;
final
int
itemCount
;
final
ScrollDirection
direction
;
final
Axis
direction
;
final
double
startOffset
;
final
Painter
overlayPainter
;
...
...
@@ -112,7 +112,7 @@ abstract class _ViewportBaseElement<T extends _ViewportBase> extends RenderObjec
}
double
getMaxCrossAxisExtent
(
BoxConstraints
constraints
)
{
if
(
widget
.
direction
==
ScrollDirection
.
vertical
)
if
(
widget
.
direction
==
Axis
.
vertical
)
return
constraints
.
maxWidth
;
return
constraints
.
maxHeight
;
}
...
...
@@ -141,7 +141,7 @@ class HomogeneousViewport extends _ViewportBase {
ListBuilder
builder
,
bool
itemsWrap:
false
,
int
itemCount
,
// optional, but you cannot shrink-wrap this class or otherwise use its intrinsic dimensions if you don't specify it
ScrollDirection
direction:
ScrollDirection
.
vertical
,
Axis
direction:
Axis
.
vertical
,
double
startOffset:
0.0
,
Painter
overlayPainter
,
this
.
itemExtent
// required, must be non-zero
...
...
@@ -180,7 +180,7 @@ class _HomogeneousViewportElement extends _ViewportBaseElement<HomogeneousViewpo
// be ok because we are exempt from that assert since we are still actively
// doing our own layout.)
BuildableElement
.
lockState
(()
{
double
mainAxisExtent
=
widget
.
direction
==
ScrollDirection
.
vertical
?
constraints
.
maxHeight
:
constraints
.
maxWidth
;
double
mainAxisExtent
=
widget
.
direction
==
Axis
.
vertical
?
constraints
.
maxHeight
:
constraints
.
maxWidth
;
double
offset
;
if
(
widget
.
startOffset
<=
0.0
&&
!
widget
.
itemsWrap
)
{
_layoutFirstIndex
=
0
;
...
...
packages/flutter/lib/src/widgets/mixed_viewport.dart
View file @
b2cef9f2
...
...
@@ -18,7 +18,7 @@ class MixedViewport extends RenderObjectWidget {
MixedViewport
({
Key
key
,
this
.
startOffset
:
0.0
,
this
.
direction
:
ScrollDirection
.
vertical
,
this
.
direction
:
Axis
.
vertical
,
this
.
builder
,
this
.
token
,
this
.
onExtentsUpdate
,
...
...
@@ -26,7 +26,7 @@ class MixedViewport extends RenderObjectWidget {
})
:
super
(
key:
key
);
final
double
startOffset
;
final
ScrollDirection
direction
;
final
Axis
direction
;
final
IndexedBuilder
builder
;
final
Object
token
;
// change this if the list changed (i.e. there are added, removed, or resorted items)
final
ExtentsUpdateCallback
onExtentsUpdate
;
...
...
@@ -315,18 +315,18 @@ class _MixedViewportElement extends RenderObjectElement<MixedViewport> {
double
_getElementExtent
(
Element
element
,
BoxConstraints
innerConstraints
)
{
final
RenderBox
childRenderObject
=
element
.
renderObject
;
switch
(
widget
.
direction
)
{
case
ScrollDirection
.
vertical
:
case
Axis
.
vertical
:
return
childRenderObject
.
getMaxIntrinsicHeight
(
innerConstraints
);
case
ScrollDirection
.
horizontal
:
case
Axis
.
horizontal
:
return
childRenderObject
.
getMaxIntrinsicWidth
(
innerConstraints
);
}
}
BoxConstraints
_getInnerConstraints
(
BoxConstraints
constraints
)
{
switch
(
widget
.
direction
)
{
case
ScrollDirection
.
vertical
:
case
Axis
.
vertical
:
return
new
BoxConstraints
.
tightFor
(
width:
constraints
.
constrainWidth
());
case
ScrollDirection
.
horizontal
:
case
Axis
.
horizontal
:
return
new
BoxConstraints
.
tightFor
(
height:
constraints
.
constrainHeight
());
}
}
...
...
@@ -353,14 +353,14 @@ class _MixedViewportElement extends RenderObjectElement<MixedViewport> {
// Establish the start and end offsets based on our current constraints.
double
extent
;
switch
(
widget
.
direction
)
{
case
ScrollDirection
.
vertical
:
case
Axis
.
vertical
:
extent
=
constraints
.
maxHeight
;
assert
(
extent
<
double
.
INFINITY
&&
'There is no point putting a lazily-built vertical MixedViewport inside a box with infinite internal '
+
'height (e.g. inside something else that scrolls vertically), because it would then just eagerly build '
+
'all the children. You probably want to put the MixedViewport inside a Container with a fixed height.'
is
String
);
break
;
case
ScrollDirection
.
horizontal
:
case
Axis
.
horizontal
:
extent
=
constraints
.
maxWidth
;
assert
(
extent
<
double
.
INFINITY
&&
'There is no point putting a lazily-built horizontal MixedViewport inside a box with infinite internal '
+
...
...
packages/flutter/lib/src/widgets/pageable_list.dart
View file @
b2cef9f2
...
...
@@ -25,7 +25,7 @@ class PageableList extends Scrollable {
PageableList
({
Key
key
,
initialScrollOffset
,
ScrollDirection
scrollDirection:
ScrollDirection
.
vertical
,
Axis
scrollDirection:
Axis
.
vertical
,
ScrollListener
onScrollStart
,
ScrollListener
onScroll
,
ScrollListener
onScrollEnd
,
...
...
@@ -68,7 +68,7 @@ class PageableListState<T extends PageableList> extends ScrollableState<T> {
final
RenderBox
box
=
context
.
findRenderObject
();
if
(
box
==
null
||
!
box
.
hasSize
)
return
0.0
;
final
double
pixelScrollExtent
=
config
.
scrollDirection
==
ScrollDirection
.
vertical
?
box
.
size
.
height
:
box
.
size
.
width
;
final
double
pixelScrollExtent
=
config
.
scrollDirection
==
Axis
.
vertical
?
box
.
size
.
height
:
box
.
size
.
width
;
return
pixelScrollExtent
==
0.0
?
0.0
:
value
/
pixelScrollExtent
;
}
...
...
@@ -183,7 +183,7 @@ class PageViewport extends VirtualViewport {
PageViewport
({
Key
key
,
this
.
startOffset
:
0.0
,
this
.
scrollDirection
:
ScrollDirection
.
vertical
,
this
.
scrollDirection
:
Axis
.
vertical
,
this
.
itemsWrap
:
false
,
this
.
overlayPainter
,
this
.
children
...
...
@@ -192,7 +192,7 @@ class PageViewport extends VirtualViewport {
}
final
double
startOffset
;
final
ScrollDirection
scrollDirection
;
final
Axis
scrollDirection
;
final
bool
itemsWrap
;
final
Painter
overlayPainter
;
final
Iterable
<
Widget
>
children
;
...
...
@@ -235,9 +235,9 @@ class _PageViewportElement extends VirtualViewportElement<PageViewport> {
double
_getContainerExtentFromRenderObject
()
{
switch
(
widget
.
scrollDirection
)
{
case
ScrollDirection
.
vertical
:
case
Axis
.
vertical
:
return
renderObject
.
size
.
height
;
case
ScrollDirection
.
horizontal
:
case
Axis
.
horizontal
:
return
renderObject
.
size
.
width
;
}
}
...
...
packages/flutter/lib/src/widgets/scrollable.dart
View file @
b2cef9f2
...
...
@@ -38,19 +38,19 @@ abstract class Scrollable extends StatefulComponent {
Scrollable
({
Key
key
,
this
.
initialScrollOffset
,
this
.
scrollDirection
:
ScrollDirection
.
vertical
,
this
.
scrollDirection
:
Axis
.
vertical
,
this
.
onScrollStart
,
this
.
onScroll
,
this
.
onScrollEnd
,
this
.
snapOffsetCallback
,
this
.
snapAlignmentOffset
:
0.0
})
:
super
(
key:
key
)
{
assert
(
scrollDirection
==
ScrollDirection
.
vertical
||
scrollDirection
==
ScrollDirection
.
horizontal
);
assert
(
scrollDirection
==
Axis
.
vertical
||
scrollDirection
==
Axis
.
horizontal
);
}
final
double
initialScrollOffset
;
final
ScrollDirection
scrollDirection
;
final
Axis
scrollDirection
;
final
ScrollListener
onScrollStart
;
final
ScrollListener
onScroll
;
final
ScrollListener
onScrollEnd
;
...
...
@@ -81,12 +81,12 @@ abstract class Scrollable extends StatefulComponent {
double
scrollOffsetDelta
;
switch
(
scrollable
.
config
.
scrollDirection
)
{
case
ScrollDirection
.
vertical
:
case
Axis
.
vertical
:
Point
targetCenter
=
targetBox
.
localToGlobal
(
new
Point
(
0.0
,
targetSize
.
height
/
2.0
));
Point
scrollableCenter
=
scrollableBox
.
localToGlobal
(
new
Point
(
0.0
,
scrollableSize
.
height
/
2.0
));
scrollOffsetDelta
=
targetCenter
.
y
-
scrollableCenter
.
y
;
break
;
case
ScrollDirection
.
horizontal
:
case
Axis
.
horizontal
:
Point
targetCenter
=
targetBox
.
localToGlobal
(
new
Point
(
targetSize
.
width
/
2.0
,
0.0
));
Point
scrollableCenter
=
scrollableBox
.
localToGlobal
(
new
Point
(
scrollableSize
.
width
/
2.0
,
0.0
));
scrollOffsetDelta
=
targetCenter
.
x
-
scrollableCenter
.
x
;
...
...
@@ -119,7 +119,7 @@ abstract class ScrollableState<T extends Scrollable> extends State<T> {
double
_scrollOffset
;
Offset
get
scrollOffsetVector
{
if
(
config
.
scrollDirection
==
ScrollDirection
.
horizontal
)
if
(
config
.
scrollDirection
==
Axis
.
horizontal
)
return
new
Offset
(
scrollOffset
,
0.0
);
return
new
Offset
(
0.0
,
scrollOffset
);
}
...
...
@@ -131,7 +131,7 @@ abstract class ScrollableState<T extends Scrollable> extends State<T> {
double
pixelToScrollOffset
(
double
pixelValue
)
=>
pixelValue
;
double
scrollDirectionVelocity
(
Offset
scrollVelocity
)
{
return
config
.
scrollDirection
==
ScrollDirection
.
horizontal
return
config
.
scrollDirection
==
Axis
.
horizontal
?
-
scrollVelocity
.
dx
:
-
scrollVelocity
.
dy
;
}
...
...
@@ -144,19 +144,19 @@ abstract class ScrollableState<T extends Scrollable> extends State<T> {
return
_scrollBehavior
;
}
GestureDragStartCallback
_getDragStartHandler
(
ScrollDirection
direction
)
{
GestureDragStartCallback
_getDragStartHandler
(
Axis
direction
)
{
if
(
config
.
scrollDirection
!=
direction
||
!
scrollBehavior
.
isScrollable
)
return
null
;
return
_handleDragStart
;
}
GestureDragUpdateCallback
_getDragUpdateHandler
(
ScrollDirection
direction
)
{
GestureDragUpdateCallback
_getDragUpdateHandler
(
Axis
direction
)
{
if
(
config
.
scrollDirection
!=
direction
||
!
scrollBehavior
.
isScrollable
)
return
null
;
return
_handleDragUpdate
;
}
GestureDragEndCallback
_getDragEndHandler
(
ScrollDirection
direction
)
{
GestureDragEndCallback
_getDragEndHandler
(
Axis
direction
)
{
if
(
config
.
scrollDirection
!=
direction
||
!
scrollBehavior
.
isScrollable
)
return
null
;
return
_handleDragEnd
;
...
...
@@ -164,12 +164,12 @@ abstract class ScrollableState<T extends Scrollable> extends State<T> {
Widget
build
(
BuildContext
context
)
{
return
new
GestureDetector
(
onVerticalDragStart:
_getDragStartHandler
(
ScrollDirection
.
vertical
),
onVerticalDragUpdate:
_getDragUpdateHandler
(
ScrollDirection
.
vertical
),
onVerticalDragEnd:
_getDragEndHandler
(
ScrollDirection
.
vertical
),
onHorizontalDragStart:
_getDragStartHandler
(
ScrollDirection
.
horizontal
),
onHorizontalDragUpdate:
_getDragUpdateHandler
(
ScrollDirection
.
horizontal
),
onHorizontalDragEnd:
_getDragEndHandler
(
ScrollDirection
.
horizontal
),
onVerticalDragStart:
_getDragStartHandler
(
Axis
.
vertical
),
onVerticalDragUpdate:
_getDragUpdateHandler
(
Axis
.
vertical
),
onVerticalDragEnd:
_getDragEndHandler
(
Axis
.
vertical
),
onHorizontalDragStart:
_getDragStartHandler
(
Axis
.
horizontal
),
onHorizontalDragUpdate:
_getDragUpdateHandler
(
Axis
.
horizontal
),
onHorizontalDragEnd:
_getDragEndHandler
(
Axis
.
horizontal
),
behavior:
HitTestBehavior
.
opaque
,
child:
new
Listener
(
child:
buildContent
(
context
),
...
...
@@ -348,7 +348,7 @@ class ScrollableViewport extends Scrollable {
Key
key
,
this
.
child
,
double
initialScrollOffset
,
ScrollDirection
scrollDirection:
ScrollDirection
.
vertical
,
Axis
scrollDirection:
Axis
.
vertical
,
ScrollListener
onScroll
})
:
super
(
key:
key
,
...
...
@@ -369,13 +369,13 @@ class ScrollableViewportState extends ScrollableState<ScrollableViewport> {
double
_viewportSize
=
0.0
;
double
_childSize
=
0.0
;
void
_handleViewportSizeChanged
(
Size
newSize
)
{
_viewportSize
=
config
.
scrollDirection
==
ScrollDirection
.
vertical
?
newSize
.
height
:
newSize
.
width
;
_viewportSize
=
config
.
scrollDirection
==
Axis
.
vertical
?
newSize
.
height
:
newSize
.
width
;
setState
(()
{
_updateScrollBehavior
();
});
}
void
_handleChildSizeChanged
(
Size
newSize
)
{
_childSize
=
config
.
scrollDirection
==
ScrollDirection
.
vertical
?
newSize
.
height
:
newSize
.
width
;
_childSize
=
config
.
scrollDirection
==
Axis
.
vertical
?
newSize
.
height
:
newSize
.
width
;
setState
(()
{
_updateScrollBehavior
();
});
...
...
@@ -412,7 +412,7 @@ class Block extends StatelessComponent {
Key
key
,
this
.
padding
,
this
.
initialScrollOffset
,
this
.
scrollDirection
:
ScrollDirection
.
vertical
,
this
.
scrollDirection
:
Axis
.
vertical
,
this
.
onScroll
})
:
super
(
key:
key
)
{
assert
(!
children
.
any
((
Widget
child
)
=>
child
==
null
));
...
...
@@ -421,7 +421,7 @@ class Block extends StatelessComponent {
final
List
<
Widget
>
children
;
final
EdgeDims
padding
;
final
double
initialScrollOffset
;
final
ScrollDirection
scrollDirection
;
final
Axis
scrollDirection
;
final
ScrollListener
onScroll
;
Widget
build
(
BuildContext
context
)
{
...
...
@@ -446,7 +446,7 @@ abstract class ScrollableListPainter extends Painter {
RenderBox
get
renderObject
=>
super
.
renderObject
;
ScrollDirection
get
scrollDirection
{
Axis
get
scrollDirection
{
HasScrollDirection
scrollable
=
renderObject
as
dynamic
;
return
scrollable
?.
scrollDirection
;
}
...
...
@@ -495,7 +495,7 @@ abstract class ScrollableWidgetList extends Scrollable {
ScrollableWidgetList
({
Key
key
,
double
initialScrollOffset
,
ScrollDirection
scrollDirection:
ScrollDirection
.
vertical
,
Axis
scrollDirection:
Axis
.
vertical
,
ScrollListener
onScroll
,
SnapOffsetCallback
snapOffsetCallback
,
double
snapAlignmentOffset:
0.0
,
...
...
@@ -554,7 +554,7 @@ abstract class ScrollableWidgetListState<T extends ScrollableWidgetList> extends
ExtentScrollBehavior
get
scrollBehavior
=>
super
.
scrollBehavior
;
double
get
_containerExtent
{
return
config
.
scrollDirection
==
ScrollDirection
.
vertical
return
config
.
scrollDirection
==
Axis
.
vertical
?
_containerSize
.
height
:
_containerSize
.
width
;
}
...
...
@@ -568,14 +568,14 @@ abstract class ScrollableWidgetListState<T extends ScrollableWidgetList> extends
double
get
_leadingPadding
{
EdgeDims
padding
=
config
.
padding
;
if
(
config
.
scrollDirection
==
ScrollDirection
.
vertical
)
if
(
config
.
scrollDirection
==
Axis
.
vertical
)
return
padding
!=
null
?
padding
.
top
:
0.0
;
return
padding
!=
null
?
padding
.
left
:
-.
0
;
}
double
get
_trailingPadding
{
EdgeDims
padding
=
config
.
padding
;
if
(
config
.
scrollDirection
==
ScrollDirection
.
vertical
)
if
(
config
.
scrollDirection
==
Axis
.
vertical
)
return
padding
!=
null
?
padding
.
bottom
:
0.0
;
return
padding
!=
null
?
padding
.
right
:
0.0
;
}
...
...
@@ -584,7 +584,7 @@ abstract class ScrollableWidgetListState<T extends ScrollableWidgetList> extends
EdgeDims
padding
=
config
.
padding
;
if
(
padding
==
null
)
return
null
;
if
(
config
.
scrollDirection
==
ScrollDirection
.
vertical
)
if
(
config
.
scrollDirection
==
Axis
.
vertical
)
return
new
EdgeDims
.
only
(
left:
padding
.
left
,
right:
padding
.
right
);
return
new
EdgeDims
.
only
(
top:
padding
.
top
,
bottom:
padding
.
bottom
);
}
...
...
packages/flutter/lib/src/widgets/scrollable_grid.dart
View file @
b2cef9f2
...
...
@@ -29,7 +29,7 @@ class ScrollableGrid extends Scrollable {
// TODO(abarth): Support horizontal offsets. For horizontally scrolling
// grids. For horizontally scrolling grids, we'll probably need to use a
// delegate that places children in column-major order.
scrollDirection:
ScrollDirection
.
vertical
,
scrollDirection:
Axis
.
vertical
,
onScroll:
onScroll
,
snapOffsetCallback:
snapOffsetCallback
,
snapAlignmentOffset:
snapAlignmentOffset
...
...
@@ -80,7 +80,7 @@ class GridViewport extends VirtualViewport {
final
Iterable
<
Widget
>
children
;
// TODO(abarth): Support horizontal scrolling;
ScrollDirection
get
scrollDirection
=>
ScrollDirection
.
vertical
;
Axis
get
scrollDirection
=>
Axis
.
vertical
;
RenderGrid
createRenderObject
()
=>
new
RenderGrid
(
delegate:
delegate
);
...
...
packages/flutter/lib/src/widgets/scrollable_list.dart
View file @
b2cef9f2
...
...
@@ -15,7 +15,7 @@ class ScrollableList extends Scrollable {
ScrollableList
({
Key
key
,
double
initialScrollOffset
,
ScrollDirection
scrollDirection:
ScrollDirection
.
vertical
,
Axis
scrollDirection:
Axis
.
vertical
,
ScrollListener
onScroll
,
SnapOffsetCallback
snapOffsetCallback
,
double
snapAlignmentOffset:
0.0
,
...
...
@@ -93,7 +93,7 @@ class ListViewport extends VirtualViewport {
Key
key
,
this
.
onExtentsChanged
,
this
.
startOffset
:
0.0
,
this
.
scrollDirection
:
ScrollDirection
.
vertical
,
this
.
scrollDirection
:
Axis
.
vertical
,
this
.
itemExtent
,
this
.
itemsWrap
:
false
,
this
.
padding
,
...
...
@@ -106,7 +106,7 @@ class ListViewport extends VirtualViewport {
final
ExtentsChangedCallback
onExtentsChanged
;
final
double
startOffset
;
final
ScrollDirection
scrollDirection
;
final
Axis
scrollDirection
;
final
double
itemExtent
;
final
bool
itemsWrap
;
final
EdgeDims
padding
;
...
...
@@ -148,9 +148,9 @@ class _ListViewportElement extends VirtualViewportElement<ListViewport> {
double
_getContainerExtentFromRenderObject
()
{
switch
(
widget
.
scrollDirection
)
{
case
ScrollDirection
.
vertical
:
case
Axis
.
vertical
:
return
renderObject
.
size
.
height
;
case
ScrollDirection
.
horizontal
:
case
Axis
.
horizontal
:
return
renderObject
.
size
.
width
;
}
}
...
...
packages/flutter/lib/src/widgets/virtual_viewport.dart
View file @
b2cef9f2
...
...
@@ -13,7 +13,7 @@ typedef void ExtentsChangedCallback(double contentExtent, double containerExtent
abstract
class
VirtualViewport
extends
RenderObjectWidget
{
double
get
startOffset
;
ScrollDirection
get
scrollDirection
;
Axis
get
scrollDirection
;
Iterable
<
Widget
>
get
children
;
}
...
...
@@ -64,10 +64,10 @@ abstract class VirtualViewportElement<T extends VirtualViewport> extends RenderO
void
_updatePaintOffset
()
{
switch
(
widget
.
scrollDirection
)
{
case
ScrollDirection
.
vertical
:
case
Axis
.
vertical
:
renderObject
.
paintOffset
=
new
Offset
(
0.0
,
paintOffset
);
break
;
case
ScrollDirection
.
horizontal
:
case
Axis
.
horizontal
:
renderObject
.
paintOffset
=
new
Offset
(
paintOffset
,
0.0
);
break
;
}
...
...
packages/flutter/test/widget/dismissable_test.dart
View file @
b2cef9f2
...
...
@@ -8,7 +8,7 @@ import 'package:flutter/widgets.dart';
import
'package:test/test.dart'
;
const
double
itemExtent
=
100.0
;
ScrollDirection
scrollDirection
=
ScrollDirection
.
vertical
;
Axis
scrollDirection
=
Axis
.
vertical
;
DismissDirection
dismissDirection
=
DismissDirection
.
horizontal
;
List
<
int
>
dismissedItems
=
<
int
>[];
...
...
@@ -120,7 +120,7 @@ class Test1215DismissableComponent extends StatelessComponent {
void
main
(
)
{
test
(
'Horizontal drag triggers dismiss scrollDirection=vertical'
,
()
{
testWidgets
((
WidgetTester
tester
)
{
scrollDirection
=
ScrollDirection
.
vertical
;
scrollDirection
=
Axis
.
vertical
;
dismissDirection
=
DismissDirection
.
horizontal
;
dismissedItems
=
<
int
>[];
...
...
@@ -139,7 +139,7 @@ void main() {
test
(
'Vertical drag triggers dismiss scrollDirection=horizontal'
,
()
{
testWidgets
((
WidgetTester
tester
)
{
scrollDirection
=
ScrollDirection
.
horizontal
;
scrollDirection
=
Axis
.
horizontal
;
dismissDirection
=
DismissDirection
.
vertical
;
dismissedItems
=
<
int
>[];
...
...
@@ -158,7 +158,7 @@ void main() {
test
(
'drag-left with DismissDirection.left triggers dismiss'
,
()
{
testWidgets
((
WidgetTester
tester
)
{
scrollDirection
=
ScrollDirection
.
vertical
;
scrollDirection
=
Axis
.
vertical
;
dismissDirection
=
DismissDirection
.
left
;
dismissedItems
=
<
int
>[];
...
...
@@ -177,7 +177,7 @@ void main() {
test
(
'drag-right with DismissDirection.right triggers dismiss'
,
()
{
testWidgets
((
WidgetTester
tester
)
{
scrollDirection
=
ScrollDirection
.
vertical
;
scrollDirection
=
Axis
.
vertical
;
dismissDirection
=
DismissDirection
.
right
;
dismissedItems
=
<
int
>[];
...
...
@@ -196,7 +196,7 @@ void main() {
test
(
'drag-up with DismissDirection.up triggers dismiss'
,
()
{
testWidgets
((
WidgetTester
tester
)
{
scrollDirection
=
ScrollDirection
.
horizontal
;
scrollDirection
=
Axis
.
horizontal
;
dismissDirection
=
DismissDirection
.
up
;
dismissedItems
=
<
int
>[];
...
...
@@ -215,7 +215,7 @@ void main() {
test
(
'drag-down with DismissDirection.down triggers dismiss'
,
()
{
testWidgets
((
WidgetTester
tester
)
{
scrollDirection
=
ScrollDirection
.
horizontal
;
scrollDirection
=
Axis
.
horizontal
;
dismissDirection
=
DismissDirection
.
down
;
dismissedItems
=
<
int
>[];
...
...
@@ -240,7 +240,7 @@ void main() {
// irrelevant by fn3, but just in case...
test
(
'Verify that drag-move events do not assert'
,
()
{
testWidgets
((
WidgetTester
tester
)
{
scrollDirection
=
ScrollDirection
.
horizontal
;
scrollDirection
=
Axis
.
horizontal
;
dismissDirection
=
DismissDirection
.
down
;
dismissedItems
=
<
int
>[];
...
...
packages/flutter/test/widget/homogeneous_viewport_test.dart
View file @
b2cef9f2
...
...
@@ -143,7 +143,7 @@ void main() {
builder:
itemBuilder
,
startOffset:
offset
,
itemExtent:
200.0
,
direction:
ScrollDirection
.
horizontal
direction:
Axis
.
horizontal
),
right:
new
Text
(
'Not Today'
)
);
...
...
packages/flutter/test/widget/mixed_viewport_test.dart
View file @
b2cef9f2
...
...
@@ -127,7 +127,7 @@ void main() {
left:
new
MixedViewport
(
builder:
itemBuilder
,
startOffset:
offset
,
direction:
ScrollDirection
.
horizontal
direction:
Axis
.
horizontal
),
right:
new
Text
(
'Not Today'
)
);
...
...
packages/flutter/test/widget/pageable_list_test.dart
View file @
b2cef9f2
...
...
@@ -26,7 +26,7 @@ Widget buildFrame({ List<int> pages: defaultPages }) {
final
list
=
new
PageableList
(
children:
pages
.
map
(
buildPage
),
itemsWrap:
itemsWrap
,
scrollDirection:
ScrollDirection
.
horizontal
,
scrollDirection:
Axis
.
horizontal
,
onPageChanged:
(
int
page
)
{
currentPage
=
page
;
}
);
...
...
packages/flutter/test/widget/scrollable_list_hit_testing_test.dart
View file @
b2cef9f2
...
...
@@ -20,7 +20,7 @@ void main() {
child:
new
ScrollableList
(
key:
new
GlobalKey
(),
itemExtent:
290.0
,
scrollDirection:
ScrollDirection
.
horizontal
,
scrollDirection:
Axis
.
horizontal
,
children:
items
.
map
((
int
item
)
{
return
new
Container
(
child:
new
GestureDetector
(
...
...
@@ -60,7 +60,7 @@ void main() {
child:
new
ScrollableList
(
key:
new
GlobalKey
(),
itemExtent:
290.0
,
scrollDirection:
ScrollDirection
.
vertical
,
scrollDirection:
Axis
.
vertical
,
children:
items
.
map
((
int
item
)
{
return
new
Container
(
child:
new
GestureDetector
(
...
...
packages/flutter/test/widget/scrollable_list_horizontal_test.dart
View file @
b2cef9f2
...
...
@@ -15,7 +15,7 @@ Widget buildFrame() {
height:
50.0
,
child:
new
ScrollableList
(
itemExtent:
290.0
,
scrollDirection:
ScrollDirection
.
horizontal
,
scrollDirection:
Axis
.
horizontal
,
children:
items
.
map
((
int
item
)
{
return
new
Container
(
child:
new
Text
(
'
$item
'
)
...
...
packages/flutter/test/widget/scrollable_list_vertical_test.dart
View file @
b2cef9f2
...
...
@@ -11,7 +11,7 @@ const List<int> items = const <int>[0, 1, 2, 3, 4, 5];
Widget
buildFrame
(
)
{
return
new
ScrollableList
(
itemExtent:
290.0
,
scrollDirection:
ScrollDirection
.
vertical
,
scrollDirection:
Axis
.
vertical
,
children:
items
.
map
((
int
item
)
{
return
new
Container
(
child:
new
Text
(
'
$item
'
)
...
...
packages/flutter/test/widget/snap_scrolling_test.dart
View file @
b2cef9f2
...
...
@@ -9,7 +9,7 @@ import 'package:flutter/widgets.dart';
import
'package:test/test.dart'
;
const
double
itemExtent
=
200.0
;
ScrollDirection
scrollDirection
=
ScrollDirection
.
vertical
;
Axis
scrollDirection
=
Axis
.
vertical
;
GlobalKey
scrollableListKey
;
Widget
buildItem
(
int
item
)
{
...
...
@@ -48,7 +48,7 @@ void set scrollOffset(double value) {
}
Future
fling
(
double
velocity
)
{
Offset
velocityOffset
=
scrollDirection
==
ScrollDirection
.
vertical
Offset
velocityOffset
=
scrollDirection
==
Axis
.
vertical
?
new
Offset
(
0.0
,
velocity
)
:
new
Offset
(
velocity
,
0.0
);
return
scrollableState
.
fling
(
velocityOffset
);
...
...
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