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
c44f0a57
Commit
c44f0a57
authored
Jan 07, 2016
by
Adam Barth
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1114 from abarth/rm_block_direction
Remove BlockDirection in favor of ScrollDirection
parents
95092bb4
76dd6228
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
13 additions
and
36 deletions
+13
-36
block.dart
packages/flutter/lib/src/rendering/block.dart
+8
-17
basic.dart
packages/flutter/lib/src/widgets/basic.dart
+2
-3
homogeneous_viewport.dart
packages/flutter/lib/src/widgets/homogeneous_viewport.dart
+1
-1
mixed_viewport.dart
packages/flutter/lib/src/widgets/mixed_viewport.dart
+1
-8
scrollable.dart
packages/flutter/lib/src/widgets/scrollable.dart
+1
-7
No files found.
packages/flutter/lib/src/rendering/block.dart
View file @
c44f0a57
...
...
@@ -13,14 +13,6 @@ import 'viewport.dart';
/// Parent data for use with [RenderBlockBase].
class
BlockParentData
extends
ContainerBoxParentDataMixin
<
RenderBox
>
{
}
/// The direction in which the block should lay out.
enum
BlockDirection
{
/// Children are arranged horizontally, from left to right.
horizontal
,
/// Children are arranged vertically, from top to bottom.
vertical
}
typedef
double
_ChildSizingFunction
(
RenderBox
child
,
BoxConstraints
constraints
);
typedef
double
_Constrainer
(
double
value
);
...
...
@@ -40,7 +32,7 @@ abstract class RenderBlockBase extends RenderBox
RenderBlockBase
({
List
<
RenderBox
>
children
,
BlockDirection
direction:
Block
Direction
.
vertical
,
ScrollDirection
direction:
Scroll
Direction
.
vertical
,
double
itemExtent
,
double
minExtent:
0.0
})
:
_direction
=
direction
,
_itemExtent
=
itemExtent
,
_minExtent
=
minExtent
{
...
...
@@ -53,9 +45,9 @@ abstract class RenderBlockBase extends RenderBox
}
/// The direction to use as the main axis.
Block
Direction
get
direction
=>
_direction
;
Block
Direction
_direction
;
void
set
direction
(
Block
Direction
value
)
{
Scroll
Direction
get
direction
=>
_direction
;
Scroll
Direction
_direction
;
void
set
direction
(
Scroll
Direction
value
)
{
if
(
_direction
!=
value
)
{
_direction
=
value
;
markNeedsLayout
();
...
...
@@ -83,10 +75,9 @@ abstract class RenderBlockBase extends RenderBox
}
/// Whether the main axis is vertical.
bool
get
isVertical
=>
_direction
==
Block
Direction
.
vertical
;
bool
get
isVertical
=>
_direction
==
Scroll
Direction
.
vertical
;
// TODO(abarth): Remove BlockDirection in favor of ScrollDirection.
ScrollDirection
get
scrollDirection
=>
isVertical
?
ScrollDirection
.
vertical
:
ScrollDirection
.
horizontal
;
ScrollDirection
get
scrollDirection
=>
_direction
;
BoxConstraints
_getInnerConstraints
(
BoxConstraints
constraints
)
{
if
(
isVertical
)
...
...
@@ -135,7 +126,7 @@ class RenderBlock extends RenderBlockBase {
RenderBlock
({
List
<
RenderBox
>
children
,
BlockDirection
direction:
Block
Direction
.
vertical
,
ScrollDirection
direction:
Scroll
Direction
.
vertical
,
double
itemExtent
,
double
minExtent:
0.0
})
:
super
(
children:
children
,
direction:
direction
,
itemExtent:
itemExtent
,
minExtent:
minExtent
);
...
...
@@ -251,7 +242,7 @@ class RenderBlockViewport extends RenderBlockBase {
ExtentCallback
maxCrossAxisDimensionCallback
,
ExtentCallback
minCrossAxisDimensionCallback
,
Painter
overlayPainter
,
BlockDirection
direction:
Block
Direction
.
vertical
,
ScrollDirection
direction:
Scroll
Direction
.
vertical
,
double
itemExtent
,
double
minExtent:
0.0
,
double
startOffset:
0.0
,
...
...
packages/flutter/lib/src/widgets/basic.dart
View file @
c44f0a57
...
...
@@ -11,7 +11,6 @@ import 'framework.dart';
export
'package:flutter/rendering.dart'
show
BackgroundImage
,
BlockDirection
,
Border
,
BorderSide
,
BoxConstraints
,
...
...
@@ -948,13 +947,13 @@ class Container extends StatelessComponent {
class
BlockBody
extends
MultiChildRenderObjectWidget
{
BlockBody
(
List
<
Widget
>
children
,
{
Key
key
,
this
.
direction
:
Block
Direction
.
vertical
this
.
direction
:
Scroll
Direction
.
vertical
})
:
super
(
key:
key
,
children:
children
)
{
assert
(
direction
!=
null
);
}
/// The direction to use as the main axis.
final
Block
Direction
direction
;
final
Scroll
Direction
direction
;
RenderBlock
createRenderObject
()
=>
new
RenderBlock
(
direction:
direction
);
...
...
packages/flutter/lib/src/widgets/homogeneous_viewport.dart
View file @
c44f0a57
...
...
@@ -207,7 +207,7 @@ class _HomogeneousViewportElement extends _ViewportBaseElement<HomogeneousViewpo
_layoutItemCount
=
math
.
max
(
0
,
_layoutItemCount
);
_updateChildren
();
// Update the renderObject configuration
renderObject
.
direction
=
widget
.
direction
==
ScrollDirection
.
vertical
?
BlockDirection
.
vertical
:
BlockDirection
.
horizontal
;
renderObject
.
direction
=
widget
.
direction
;
renderObject
.
itemExtent
=
widget
.
itemExtent
;
renderObject
.
minExtent
=
getTotalExtent
(
null
);
renderObject
.
startOffset
=
offset
;
...
...
packages/flutter/lib/src/widgets/mixed_viewport.dart
View file @
c44f0a57
...
...
@@ -509,14 +509,7 @@ class _MixedViewportElement extends RenderObjectElement<MixedViewport> {
int
index
=
startIndex
;
if
(
haveChildren
)
{
// Update the renderObject configuration
switch
(
widget
.
direction
)
{
case
ScrollDirection
.
vertical
:
renderObject
.
direction
=
BlockDirection
.
vertical
;
break
;
case
ScrollDirection
.
horizontal
:
renderObject
.
direction
=
BlockDirection
.
horizontal
;
break
;
}
renderObject
.
direction
=
renderObject
.
direction
;
renderObject
.
startOffset
=
_childOffsets
[
index
]
-
widget
.
startOffset
;
// Build all the widgets we still need.
while
(
_childOffsets
[
index
]
<
endOffset
)
{
...
...
packages/flutter/lib/src/widgets/scrollable.dart
View file @
c44f0a57
...
...
@@ -424,14 +424,8 @@ class Block extends StatelessComponent {
final
ScrollDirection
scrollDirection
;
final
ScrollListener
onScroll
;
BlockDirection
get
_direction
{
if
(
scrollDirection
==
ScrollDirection
.
vertical
)
return
BlockDirection
.
vertical
;
return
BlockDirection
.
horizontal
;
}
Widget
build
(
BuildContext
context
)
{
Widget
contents
=
new
BlockBody
(
children
,
direction:
_d
irection
);
Widget
contents
=
new
BlockBody
(
children
,
direction:
scrollD
irection
);
if
(
padding
!=
null
)
contents
=
new
Padding
(
padding:
padding
,
child:
contents
);
return
new
ScrollableViewport
(
...
...
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